1. The remote branch is generated when the local branch is pushed to the server. For example, the master node is the most typical remote Branch (default ).
1 |
$: git push origin master |
Apart from the master, we can also create branches and push them to the server. For example:
1 |
$: git push origin develop |
2 |
Counting objects: 27, done . |
3 |
Delta compression using up to 2 threads. |
4 |
Compressing objects: 100% (15/15),
done . |
5 |
Writing objects: 100% (15/15), 7.30 KiB,
done . |
6 |
Total 15 (delta 10), reused 0 (delta 0) |
7 |
To git@search.ued.taobao.net:projects/search.git |
8 |
1b95a57..779dbe1 develop -> develop |
2. The remote branch must be differentiated from the local branch. Therefore, when pulling a specific branch from the server, you must specify the local branch name.
1 |
$: git checkout --track origin/develop |
Note that this command has the -- track parameter, so git1.6.4 or above is required! In this way, git automatically switches to the develop branch. 3. synchronize local remote branches:
4. Submit the branch data to the remote server:
1 |
$: git push origin <local_branch_name>:<remote_branch_name> |
For example:
1 |
$: git push origin develop:develop |
Of course, you can directly
5. Delete the remote branch develop:
1 |
$: git push origin :develop |
At the first creation, there were no branches on the server (using git init -- bare). Then, a branch must be pushed to the server after being created locally.
That is, the first push must write git push origin master: master as follows:
Git checkout master // get the head of the master version.
Git checkout tag_name // get the version of tag_name on the current Branch
Git checkout master file_name // discard the current modification to the file file_name
Git checkout branch_name tag_name // get the version of tag_name of the specified branch_name Branch
Git checkout commit_id file_name // get the version of file_name in commit_id.
Commit_id is the Sha value when git commit is used.
List the patches corresponding to a commit ID (xxxxxxxxxxxxxxxx:
$ Git log-1-P xxxxxxxxxxxxxxxx
$ Git format-patch-1 xxxxxxxxxxxxxxxx <=-1 cannot be omitted
-- Stdout // print to standard output
$ Git show xxxxxxxxxxxxxxxx
$ Git diff-tree-P xxxxxxxxxxxxxxxx