(In particular, the fetch step run by pull brings over only origin/master, and it does not update the ref in your repo:1 any new commits winds up referred-to only by the special FETCH_HEAD reference. So this is almost the same as doing the two steps by hand, but there are some subtle differences that probably are not too concerning to you. The pull command instructs git to run git fetch, and then the moral equivalent of git merge origin/master. You can insert -no-ff or -ff-only to prevent a fast-forward, or merge only if the result is a fast-forward if you like. Sometimes this is only useful for Warm Fuzzy Feelings ("ah, yes, that is in fact what I want") and sometimes it is useful for changing strategies entirely ("whoa, I don't want THAT stuff yet").įinally, the merge command takes the given commit, which you can name as origin/master, and does whatever it takes to bring in that commit and its ancestors, to whatever branch you are on when you run the merge. In practice, git fetch maybe more secure because before the merge we can see the changes and decide whether to merge. The command above is the equivalent to git fetch and git merge. They get traced to your repository, but named origin/branch for any branch named branch on the remote.Īt this point, you can use any viewer like git log, gitk, etc to see "what they have" that you don't, and vice versa. git pull: Git is going to get the latest version from the remote and merge into the local. The named remote (origin) and says to it: "gimme everything you have that I don't", i.e., all commits on all branches. The fetch command can be done at any point before the merge, i.e., you can swap the order of the fetch and the checkout, because fetch just goes over to Git fetch origin # gets you up to date with the origin Git checkout dmgr2 # you have reached and are currently into " branch dmgr2" The steps you listed will work, but there's a long way that gives you more options:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |