简体   繁体   中英

github git merging branches

I'm a bit confused about what I did here. It seems that I created a branch (I don't remember even doing it), but it is only local. I don't see it as an option on github when looking at the different branches. How can I merge this branch to the master branch on github with being sure I'm not going to lose my files? I'm pretty new to git obviously.

Thanks, Matthew

How can I merge this branch to the master branch on github with being sure I'm not going to lose my files?

First, you have to do it locally and then push the changes. So for merging your feature branch into master you do this:

assuming you are in your branch

$ git checkout master
$ git merge <my_branch>
$ git push origin master

If you want to be super sure that anything can't go wrong, do the backup first..

$ git checkout -b backup-branch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM