Using git with two branches
Now we have the update software in the remote master branch. We are going to do the changes and want to add to the remote master branch.
First we need to checkout to the dev branch (it is the local dev branch)
- git checkout dev
getting all the updates from the current updated remote master branch
- git pull origin master
Doing the changes locally and adding the files to the local dev
- git add
Now we are going to commit the local dev changes to the staging for the remote dev branch
- git commit
now it is in staging. And we are going to push in to the remote dev branch
- git push origin dev
And now the local dev and remote dev will be merged
Now we have to get all the local dev changes to the local master. After that only we can push it to the remote master and updating the software.
Therefore we have to pull the changes in the remote dev branch to local master
- git checkout master
- git pull origin dev
Now if we see the
- git status
- it will show the message like your branch is ahead of 'origin/master' by 1 commits.
It is because
our local master branch is ahead by 1 commits comparing to the remote master branch.
Now we have to merge the local master branch to remote master branch therefore we need the push the local commits to the remote
- git push
Now all the things are up to date.
0 Comments