# and have 2 and 3 different commits each, respectively. # Your branch and 'origin/development' have diverged, It will not only push and create a new branch in the remote. Git tells you about this right in the output for "git status": $ git status We can do this by using the -set-upstream or the -u flag along with the Git Push command. This information helps tremendously in staying up-to-date. With an upstream branch set, you can simply use the shorthand commands git pull and git push - instead of having to think about the exact parameters like in. (b) if there are 4 commits on the remote upstream branch which you haven't pulled yet, then your local branch is "4 commits behind" its upstream branch. (a) if you have 2 commits in your local repository which you haven't pushed to the remote yet, then your local branch is "2 commits ahead" of its upstream branch. Git can now also tell you about unsynced commits which you haven't pushed or pulled, yet. With an upstream branch set, you can simply use the shorthand commands "git pull" and "git push" - instead of having to think about the exact parameters like in "git push origin development". It fetches and merges changes from the remote server to your working directory. If the remote is fetched successfully, add upstream (tracking) reference, used by argument-less git pull and other commands. git push -u origin master git push -set-upstream origin master. You also have git fetch -set-upstream and git pull -set-upstream. This relationship is very helpful for two reasons: set-upstream is not just about git branch -u or git push -u. Let's also say that you've set the remote "origin/development" as its upstream branch. Let's say that your current local HEAD branch is named "development". Why should you set up an upstream branch for a local branch? In practice, however, in makes lots of sense to see them as counterparts - connected in a so-called "tracking connection". ![]() In theory, local and remote branches in Git are completely separate items.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |