Reputation: 273
I am working on a local git repository. There are two branches,master and development. I want to push development changes to master branch, how do I do that? When I do:
git branch -a
I see...
* development
master
remotes/origin/HEAD -> origin/master
remotes/origin/development
remotes/origin/master
Upvotes: 6
Views: 30828
Reputation: 15992
Make sure first you update your development branch with master to resolve conflicts issue(if there are any):
git checkout master
git pull origin master
git checkout development
git merge master
Now see if master branch is merged without any conflict, if there's any conflict then you'll have to resolve them. Once you're done with that, you can:
git checkout master
git merge development
git push origin master
Upvotes: 15
Reputation: 2558
You want to be on the master branch then merge the development branch into it. If there are conflicts it will fail and tell you where they are.
git checkout master
git merge development
I tend to be over cautious and do everything in a local, disposable, repository then push it back upstream after everything is sorted/merged.
Upvotes: 2