在已经建好organization 和 team的情况下,可以按照如下步骤进行协同开发


第一次提交

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
git clone https://github.tamu.edu/HelloWorld/TA_Assignment_System.git
// change to dev branch
git checkout dev
//check what's current branch
git branch
//after add or modified some files
git add file1.txt file2.txt file3.txt
//check file status
git status
//pull the latest dev version from remote
//you should always pull before push
git pull origin dev
//commit files and add explanation
git commit -m "your explanation"
//push to remote
git push origin dev

以后的提交

只需要上面步骤的后面几步了

1
2
3
4
5
6
7
git add file1.txt file2.txt file3.txt
git pull origin dev
git commit -m "your explanation"
git push origin dev

常用git命令


  • add/delete files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//add specific files
git add [file1] [file2] ...
//add current dir including its subdirs
git add [dir]
//add all files in current dir
git add .
//delete specific files
//delete files in your disk and index area
git rm -f [file1] [file2] ...
//delete files in index area but they remains in your disk
git rm --cached [file1] [file2] ...
  • branch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//list all local branches
git branch
//list all remote branches
git branch -r
//list all local & remote branches
git branch -a
//create a new branch, but remain in the original branch
git branch [branch-name]
//create a new branch and change to new branch
git checkout -b [branch]
//change to specific branch
git checkout [branch-name]