![]() ![]() If you get in the habit of using -u to capture the remote branch you intend to track, I recommend setting your fault config value to upstream. As Mark mentions in a comment, in addition to git pull this setting also affects default behavior of git push.Note that tracking information has been set up so that git pull works as expected without specifying the remote or branch. Now if we add -u: $ git push -u origin testīranch test set up to track remote branch test from origin. Use something like the following in your configuration file: If you often merge with the same branch, you may want to Specify which branch you want to use on the command line and Your configuration file does not tell me, either. You asked me to pull without telling me which branch you To see the difference, let's use a new empty branch: $ git checkout -b testįirst, we push without -u: $ git push origin test git push -u sets this information for the branch you're pushing. When you do a git pull from a branch, without specifying a source remote or branch, git looks at the rge setting to know where to pull from. What did that do? It didn't seem to have any effect at all. However, incorrectly thinking I would have to push again to origin from master, I ran: # note: no -u Then, I unwittingly successfully pushed my second commit to my remote repository using: git commit -m '' I successfully set up a remote repository with github, and I successfully pushed my first commit to it with: git push -u origin master If you wish to setup git pull so that it merges into from another branch in the local repository, you can point rge to the desired branch, and use the special setting. Specify multiple values to get an octopus merge. Without this option, git pull defaults to merge the first refspec fetched. The merge information is used by git pull (which at first calls git fetch) to lookup the default branch for merging. The value is handled like the remote part of a refspec, and must match a ref which is fetched from the remote given by "branch.remote". When in branch, it tells git fetch the default refspec to be marked for merging in FETCH_HEAD. It tells git fetch/git pull which branch to merge and can also affect git push (see fault). For more information, see rge in git-config(1).ĭefines, together with branch.remote, the upstream branch for the given branch. I'm apparently terrible at using git, despite my best attempts to understand it.įor every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |