Remote Warehouse Management

Source: Internet
Author: User
Tags commit using git
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:
1 $: Git fetch origin
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
1 $: Git push
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.