So I have 3 git branches:
- master
- refresh
- auth_upgrade
I haven't really been using branches like I should..开发者_如何学Python.so master
is way out of date, refresh
is somewhat out of date and auth_upgrade
is actually the branch that is completely current.
So...I ultimately want to make auth_upgrade
the master branch and then git push
it to my github repo.
What's the best process for doing that?
You could pull auth_upgrade
into master
.
$ git co master
$ git pull . auth_upgrade
- then do mainline work on
master
and use this branch to sync with your remote .. - apply the same procedure to
refresh
, if there are some unique changes you want to include ..
see:
$ man git-pull
git-pull - Fetch from and merge with another repository or a local branch
You can rename branches with the git branch -m
option:
git branch -m master old_master
git branch -m auth_upgrade master
If when you say 'out of date' the old branches are strict ancestors then you don't really have any merge issues.
If you just want to make your current branch into the master branch on your remote repository you can just do:
git push origin HEAD:master
Edit: from one of your comments it sounds like you don't have all of the changes from remote master in your current branch, though, so you may need to merge them in before pushing successfully:
git fetch
git merge origin/master
You can then delete you local branches. delete with a small -d
is safe in that it only deletes branches that are ancestors of your current branch.
git branch -d master
git branch -d refresh.
If it bothers you that your local branch isn't called master you can now do:
git checkout -b master
git branch -d auth_upgrade
精彩评论