Difference between revisions of "Setting up an Online Repository"
m |
|||
Line 8: | Line 8: | ||
==Terminology== | ==Terminology== | ||
− | [[File:Git-branch-demonstration.png|alt=|thumb|Git branches are useful to separate your version from | + | [[File:Git-branch-demonstration.png|alt=|thumb|Git branches are useful to separate your version from the main project version, and later be merged when your work is done.The master branch is blue, and the side branch is green.]] |
*<u>Commit</u> - A snapshot of the project. Its purpose is to allow to revert unwanted changes and any accidents (such as deleting something). On the graph below, individual dots are commits. | *<u>Commit</u> - A snapshot of the project. Its purpose is to allow to revert unwanted changes and any accidents (such as deleting something). On the graph below, individual dots are commits. | ||
+ | *<u>Pull</u> - "Download" commits from the branch in the repository. You pull in order to update the project on your end. | ||
+ | *<u>Push</u> - "Upload" your local commits to the repository. You push in order to update the project on the repository. | ||
*<u>Repository</u> - The service that stores each commit; it is often used as a substitute for the folder which holds the project. | *<u>Repository</u> - The service that stores each commit; it is often used as a substitute for the folder which holds the project. | ||
*<u>Branch</u> - A separate chain of commits; think of it as making your own version of the project, while others make their own ones. | *<u>Branch</u> - A separate chain of commits; think of it as making your own version of the project, while others make their own ones. | ||
− | *<u>Master Branch</u> - The mutual version of the project; every now and then you (or the project manager) will need to merge your version with the "official" (master) one. This will create a new commit. However, before branches can be merged, you will need to push | + | *<u>Master Branch</u> - The mutual version of the project; every now and then you (or the project manager) will need to merge your version with the "official" (master) one. This will create a new commit. However, before branches can be merged, you will need to push your changes to the online repository. You should also make it a habit to pull from the master branch before starting any work. |
− | *<u>Tip</u> - | + | *<u>Tip</u> - The latest commit in a branch. |
− | |||
− | |||
==Getting Started== | ==Getting Started== | ||
− | + | One of the easiest ways to setup an online repository is to use the following services: | |
− | |||
*GitLab | *GitLab | ||
*GitKraken | *GitKraken | ||
− | + | It is necessary to install GitKraken on our local machine and later set up the local and online repository. | |
− | It is necessary to install | ||
− | |||
− | |||
#[https://gitlab.com/ Register a free account at GitLab] | #[https://gitlab.com/ Register a free account at GitLab] | ||
− | |||
#[https://www.gitkraken.com/ Download and install GitKraken Git GUI] | #[https://www.gitkraken.com/ Download and install GitKraken Git GUI] | ||
Line 44: | Line 39: | ||
#*(Optional) Selecting the Initialize repository with a README option creates a README file so that the Git repository is initialized, has a default branch, and can be cloned. | #*(Optional) Selecting the Initialize repository with a README option creates a README file so that the Git repository is initialized, has a default branch, and can be cloned. | ||
#Click '''Create project.''' | #Click '''Create project.''' | ||
− | {{note|Usually, you may want to initialize your project with a '''README''' file, but if you already have an existing mod folder you want to push to git, do not initialize your project with a '''README''' file. Save the project and follow the instructions inside for '''pushing an existing folder'''.}} | + | {{note|Usually, you may want to initialize your project with a '''README''' file, but if you already have an existing mod folder you want to push to git, do not initialize your project with a '''README''' file. Save the project and follow the instructions inside for '''pushing an existing folder'''.}} |
− | |||
==Setting up GitKraken== | ==Setting up GitKraken== | ||
Line 52: | Line 46: | ||
#Select '''GitLab''' and click on '''Connect to GitLab'''. | #Select '''GitLab''' and click on '''Connect to GitLab'''. | ||
#Approve the connection. | #Approve the connection. | ||
+ | #It is recommended to generate an SSH key and add it to your GitLab account. [https://www.youtube.com/watch?v=z7jVOenqFYk Here's a guide]. | ||
==Cloning the Project using GitKraken== | ==Cloning the Project using GitKraken== | ||
Line 60: | Line 55: | ||
#Wait until the files are copied. When it's done, a prompt will show up to open the repo in the app - click on it to open the repository window. | #Wait until the files are copied. When it's done, a prompt will show up to open the repo in the app - click on it to open the repository window. | ||
#You can now create branches, commit, pull and push your changes via GItKraken! | #You can now create branches, commit, pull and push your changes via GItKraken! | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==See Also== | ==See Also== |
Revision as of 18:07, 31 July 2020
This article describes the process of setting up an online Git repository, and discusses the workflow.
![Note icon.png](/nsfr_img_auth.php/d/d5/Note_icon.png)
Contents
Why do I Need a Repository?
The biggest benefit is to combine changes made by all members of the mod team into a single "current" copy. If you're working on a mod by yourself, you probably don't need an online repository. However, an offline one will still give you many other benefits, which online repositories also provide. If you break something, you can easily compare to the previous version (or rollback to it), and easily keep track of exactly what things you've changed since the previous version. Also, if valve update the source code, a repository can make the task of merging the two versions of the code considerably easier.
Terminology
- Commit - A snapshot of the project. Its purpose is to allow to revert unwanted changes and any accidents (such as deleting something). On the graph below, individual dots are commits.
- Pull - "Download" commits from the branch in the repository. You pull in order to update the project on your end.
- Push - "Upload" your local commits to the repository. You push in order to update the project on the repository.
- Repository - The service that stores each commit; it is often used as a substitute for the folder which holds the project.
- Branch - A separate chain of commits; think of it as making your own version of the project, while others make their own ones.
- Master Branch - The mutual version of the project; every now and then you (or the project manager) will need to merge your version with the "official" (master) one. This will create a new commit. However, before branches can be merged, you will need to push your changes to the online repository. You should also make it a habit to pull from the master branch before starting any work.
- Tip - The latest commit in a branch.
Getting Started
One of the easiest ways to setup an online repository is to use the following services:
- GitLab
- GitKraken
It is necessary to install GitKraken on our local machine and later set up the local and online repository.
Creating the Project on GitLab
- In your dashboard, click the green New project button or use the plus icon in the navigation bar. This opens the New project page.
- On the New project page, choose blank project.
- On the Blank project tab, provide the following information:
- The name of your project in the Project name field. When adding the name, the Project slug will auto populate. The slug is what the GitLab instance will use as the URL path to the project. If you want a different slug, input the project name first, then change the slug after.
- The Project description (optional) field enables you to enter a description for your project’s dashboard, which will help others understand what your project is about. Though it’s not required, it’s a good idea to fill this in.
- Changing the Visibility Level modifies the project’s viewing and access rights for users.
- (Optional) Selecting the Initialize repository with a README option creates a README file so that the Git repository is initialized, has a default branch, and can be cloned.
- Click Create project.
![Note icon.png](/nsfr_img_auth.php/d/d5/Note_icon.png)
Setting up GitKraken
- Open GitKraken.
- Go to File->Preferences->Authentication.
- Select GitLab and click on Connect to GitLab.
- Approve the connection.
- It is recommended to generate an SSH key and add it to your GitLab account. Here's a guide.
Cloning the Project using GitKraken
- Open a new tab if there isn't one open already, and click on Clone a Repo and then GitLab
- In Where to clone to, navigate to the directory in which you want to place the mod folder at.
- Select the Repository to clone and click on Clone the repo!
- Wait until the files are copied. When it's done, a prompt will show up to open the repo in the app - click on it to open the repository window.
- You can now create branches, commit, pull and push your changes via GItKraken!