![Update local branch to master git](https://loka.nahovitsyn.com/238.jpg)
![update local branch to master git update local branch to master git](https://i.ytimg.com/vi/BXVZNRTijxY/maxresdefault.jpg)
The following command will delete the remote “dev” branch. The above command deletes the branch only on your local git repository in your laptop.Īs you see from the following output, the “dev” branch is still in the remote git repository. To delete the dev branch, execute the following command. Now that you’e completed your development work, and merged the changes to master branch, you may want to delete your “dev” branch. Once the merge is done, make sure to do a git push, to push your changes to the remote repository.
![update local branch to master git update local branch to master git](https://www.devguide.at/wp-content/uploads/2019/06/branch-1.png)
All git does in the master branch is to move the HEAD pointer in the master branch to the latest commit from the “dev” branch. You’ll see the word “Fast-forward” in the above output. Once you are in the master branch, execute git merge dev as shown below to merge the “dev” branch with master. Once you are done with your development work on the “dev” branch, and validated your changes, you may want to merge the changes to the master branch.įor this, first switch your working branch from dev to master as shown below. Now if you do a git branch -a, you'll see both local and remote "dev" branch.
![update local branch to master git update local branch to master git](https://www.itzgeek.com/wp-content/uploads/2019/04/Rename-Local-and-Remote-Git-Branch.jpg)
Writing objects: 100% (3/3), 307 bytes | 307.00 KiB/s, done.īranch dev set up to track remote branch dev from origin. The following git push command will create the remote “dev” branch if it doesn’t exists, and push all your local “dev” branch changes to the remote “dev” branch. Push the dev Branch to Remote Git Repository Upstream # git pushįatal: The current branch dev has no upstream branch.ģ. When you do a git push at this stage, it will give the following error message, as we don’t have the “dev” branch in the remote git repository. Even if you are the only person who is working on the “dev” branch, it is still a good idea to push your local changes to remote git repo to keep a remote backup of your changes. This way, you can push all your changes to the remote dev branch, and someone else who is working on the “dev” branch can then checkout the changes. It’s better to push our local “dev” branch to the remote git repository. It’s important to understand that when we initially created our branch, it exists only locally on our local laptop. # git commit -a -m "Fixed email address"ġ file changed, 1 insertion(+), 1 deletion(-) Since we are already inside the dev branch, any commit that we do will happen only on the dev branch. # vim index.htmlĬommit the change to the dev branch. In this example, let us make a change to index.html file. Any change that you do from now on will be only on the “dev” branch. Now that we have a new “dev” branch, start making your changes here. The following git status command indicates that we are currently on the new “dev” branch. # git branch -aĪs you see from the above output, the * is now in front of dev, which indicates the current working branch is dev. Verify that the new branch got created as shown below.
#Update local branch to master git code#
For the impatient, here is the code snippet for the above steps: # Clone the git repo:
![Update local branch to master git](https://loka.nahovitsyn.com/238.jpg)