GitLab rename branch and start over on another
I just started on a new project and I'm using GitLab with SourceTree. I had created a branch (originmaster) but I did the mistake of using this branch for my development, so I pushed my first few changes to this branch. Now I learned that this branch should actually have the production version and that an origindevelop branch should be used for development.
Is there any way I can rename the master branch to origindevelop and somehow create a new originmaster branch with the original version of the application?
I'm the only developer in the project so it won't affect anyone. If possible, if you can explain how to do it in SourceTree since I don't use the command line git. I'm more familiar with SourceTree.
You could try something like this. Answer modified from this great answer, to suit OP's needs.
git branch -m master develop # rename master on local
git push origin :master # delete master on remote
git push origin develop # create develop on remote
git checkout -b master develop # create a new local master on top of develop
git push origin master # create master on remote
SourceTree instuctions as of version 2.0.20.1
Easiest way to fix this is to revert the commit. If this was the last commit made, you can fix this by doing the following:
$ git revert HEAD
How to do this in source tree is below:
http://flummox-engineering.blogspot.com/2014/10/how-to-undo-git-commit-in-sourcetree.html
Now everything should be back to normal before the push you did to the wrong repository.
链接地址: http://www.djcxy.com/p/94806.html上一篇: 为什么会用“git merge”
下一篇: GitLab重命名分支并重新开始