Source: http://blog.tsnrose.com/2012-04-18-git-fetch.html (Thanks to the author for sharing)Sometimes we need to get other people's code repositories, to merge others (not push to the remote repository), to incorporate their own modifications, or to look at the code under a branch of someone else (without actually switching to someone else's branch), this article
There are 2 commands in git that get the latest version from the remote branch to the Local:
git fetch: The equivalent of getting the latest version from remote to local, not automatically merge
Git fetch
If you want to fetch a branch on GitHub to the local machine, directly enter the following command:
Git checkout origin/
Result error:
Error: pathspec 'origin/feature_renrendai_tongji 'did not match any file (s) known to git
Git status Faq:when I issue the "Git status" command, I see the following "Your branch is ahead or origin/master ..." git Message# on Branch master# Your branch are ahead of '
1, from the Remote Repository clone project to the local, in addition to create a current remote head pointer to the branch, but also copy the remote Repository branch to the local, can be through git branch-a or git Branch-r to v
There is a problem with submitting a local branch to the remote library for Ubuntu:Solution: Execute the following command:git remote add origin [email protected]:yourusername/test. GitYourUserName: Name of the GitHub registryTest: for Remote library name:The commands to be executed are:git remote add origin [email protected]:fwl8888/f01. gitExecute the push subm
names it locally as origin/master. Git will also give you a local master branch that points to the same place as the master branch of origin, so you have the basis for the job.
Remote Repository The name "origin", like the
, with the git status view workspace, it's clean (unless you have a file that's not managed by git), so you can safely create a branch to fix the bug.First determine which branch to fix the bug on, assuming that you need to master fix it on the branch, from master creating a
Use the git branch-a command to view all local and remote branches (git branch-r can view only remote branches)Found that many of the branches that have been deleted in the remote repository are still visible locally.
$ git branch
. Then Git builds a local branch of your own, starting with the master origin master same location on the branch where you can start working (see Figure 3-22):
Figure 3-22.Once a git clone builds your own local branch mast
Tag: File mat sed repos. NET git diff stat file objectsSee what branch are currently available[emailprotected] xmrobotium$ git branch* masterCreate a new branch xm2.x[emailprotected] xmrobotium$ git
the modified files need to be submitted before switching branches
1. Switch branches
Git checkout-b branchname to create a branch locally and switch to that branch
V. Merging of branches
1. Merge the Branch (Branchname) in development into the main branch (Otherbranchname)
.
With git checkout test, we can switch to the test branch.
#git checkout testSwitched to branch 'test'#git branch master*test
Through the git checkout-B xx command, we can create xx
You can update the remote repository's code locally using git fetch and git pull, but there is a difference between them. Today search git pull and fetch, found that the amount of information is very large, involved in git a lot o
You can update the remote repository's code locally using git fetch and git pull, but there is a difference between them. Today search git pull and fetch, found that the amount of information is very large, involved in git a lot o
This article refers to: http://www.zhanglian2010.cn/2014/07/git-pull-vs-fetch-and-merge/You can update the remote repository's code locally using git fetch and git pull, but there's a difference between them.git fetchgit fetch
1. Create local branch Local_branch
Git branch Local_branch
2. Create local branch Local_branch and switch to Local_branch branch
Git checkout-b local_branch
3. Switch to Branch Local
When you clone from a remote repository, git actually automatically corresponds to the local branch master and the remote master branch, and the default name for the remote repository is origin .To view information for a remote library, use git remote :$
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.