The remote branch is generated when the local branch is push to the server. For example, Master is the most typical remote branch (default).
1 |
$: Git push origin master |
In addition to master, we can create branches casually 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 (delta), reused 0 (Delta 0) |
7 |
To Git@search.ued.taobao.net:projects/search.git |
8 |
1b95a57. 779DBE1 Develop-Develop |
2. Remote and local branches need to be differentiated, so when you pull a specific branch from the server, you need to specify the local branch name.
1 |
$: Git checkout--track origin/develop |
Note that this command requires more than git1.6.4 because of the--track parameter. This way git will automatically switch to the develop branch.
3. Synchronize the local remote branch:
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, if currently under the develop branch, you can also directly
5. Delete Remote Branch Develop:
1 |
$: Git push origin:d Evelop |
The first time you create it, there is no branch on the server (using GIT init--bare). Then you need to push a branch to the server after you have created it locally.
That is, the first push must be written like this GIT push Origin master:master
git checkout master//Take out the master version of head.
git checkout tag_name//Remove the tag_name version on the current branch
git checkout master file_name//Discard current changes to file file_name
git checkout branch_name tag_name//Take tag_name version of the specified branch Branch_name
git checkout commit_id file_name//Fetch file file_name in commit_id Yes version.
COMMIT_ID is the SHA value for Git commit.
List the patches for a commit ID (XXXXXXXXXXXXXXXX):
$ git log-1-p xxxxxxxxxxxxxxxx
$ git format-patch-1 xxxxxxxxxxxxxxxx <===-1 not omitted
--stdout//Print to standard output
$ git show xxxxxxxxxxxxxxxx
$ git diff-tree-p xxxxxxxxxxxxxxxx