Hey guys! Here are some tips for you to start a git project from creating a repository to running the project as a team.
Full Steps to start a git project
- Create a remote Gitee repository.
- Create new branches as you wish. (Generally, you should create several branches as many as your team member)
- Create a local folder to retrieve initial files from the remote Gitee repository.
- Open the local folder with VS Code.
- Use "Ctrl + Shift + ` " to open terminal in VS Code.
- Next, follow the steps to gitify your local folder.
-
git init
- initialized empty Git repository -
git remote add origin https://gitee.com/xxxx/xxxx.git
- add remote repository -
git pull origin <remote_branch_name>
(likegit pull origin dev_example
) - pull and obtain remote code to local folder -
git checkout -b <local_branch_name>
(NOTICE: the <local_branch_name> should be exactly the same as remote one. Likegit checkout -b dev_example
) - create local branch to associate with remote one
-
- So far, you have clone the project to your local folder which is connected to the remote repository as well.
- To synchronize local change to remote one, please use these steps below.
-
git add "newChageFile.xx"
- add new file -
git commit -m "new change explanation"
- add change explanation -
git push origin <your_branch_name>
(likegit push origin dev_example
) - push your change to your remote branch
-
- Until now, for a common developer in a team, these commands are far enough.
If you are going to merge members' change to the project, you should follow the additional steps below.
-
git checkout master
- go to master branch -
git pull origin <member_branch_name>
(likegit pull origin dev_example
) - get member's change -
git push origin master
- update this member's change to the project - Repeat steps 1-3 until all members' changes have been updated.