![]() ![]() # and have 2 and 3 different commits each, respectively. # Your branch and 'origin/development' have diverged, Git tells you about this right in the output for "git status": $ git status This information helps tremendously in staying up-to-date. (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. 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. (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. Run the git push -set-upstream origin command. ![]() 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". To set upstream the local branch, firstly, move to the Git repository and clone remote repository. This relationship is very helpful for two reasons: 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". We are going to do this by creating a local folder and initialize it for git using the Git Bash Terminal. They methods are: Method 1- Using the git push command The simplest method is to use the 'git push' command with the -u option for upstream branch. Why should you set up an upstream branch for a local branch? There are various methods of setting up Upstream branches in Git. 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. |