[英]How to merge changes from master to my branch in git
I mistakenly worked on master branch, 我错误地在master分支上工作,
How can i move my changes to my branch from master? 如何将更改从主服务器移到我的分支?
Thanks. 谢谢。
You can run the following commands from the root directory of your repository 您可以从存储库的根目录运行以下命令
git reset HEAD -- . #this will unstage all the files
git stash #this will stash all the changes
git checkout <your_branch> #this will switch the branch
git stash pop #this will apply all the stashed changes in <your_branch>.
#If there are conflicts at this point, resolve them, then do the following
git add -all
git commit -am "<your_commit_message>" #this will commit in new branch.
Note: statement after #
is a comment. 注意:
#
后面的语句是注释。 It doesn't belong to the command & should be excluded when executing the command. 它不属于命令,在执行命令时应排除在外。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.