Git usage Tips: Fetch, merge, remote

Source: Internet
Author: User
Tags using git

Recently doing project, using git, so write it down to summarize.

git clone, add and commit don't say anything ...

The main thing about remote-side warehouses.

First, you get something from the master branch on the remote library first:

Git fetch Origin Master

Origin is the remote repository default name, and if you re-fetch the remote repository name at remote Add, use your own name, and master is the remote branch name.

This is just the equivalent of copying the code from the remote library to local, there is no local merge, which is why not pull directly, because the first fetch and then merge we can first look at the things pulled down, and then decide whether to merge.

If you want to see what's the difference between a local branch and what you just copied, use Origin/master:

diff Yourlocalbranch Oringin/master

Down is on the current branch, merging Origin/master, it is necessary to use the merge:

git merge Oringin/master

You can also use:

Git rebase origin/master

If there is a conflict, then resolve the conflict, then commit. If it's not going to work out, you can recover:

git reset Merge

If you want to view remote library information:

Git remote-v

The proxy for Git fetch if you need to set:

git config--global http.proxy http://proxyadress

Sometimes there will be a change of permissions due to chmod and so on, causing a pile of files to become modified, what old mode, new mode, and so on, run:

False

There is also if you add a remote branch, but git branch-a and can not see, how to do? Run:

git Remote update

That's it! will continue to add slowly in the future

Git usage Tips: Fetch, merge, remote

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.