如何将更改从 master 合并到 git 中的我的分支
How to merge changes from master to my branch in git
我错误地在 master 分支上工作,
如何将我的更改从 master 移动到我的分支?
谢谢。
您可以从存储库的根目录运行执行以下命令
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.
注:#
后的语句为注释。它不属于命令&执行命令时应该排除。
我错误地在 master 分支上工作,
如何将我的更改从 master 移动到我的分支?
谢谢。
您可以从存储库的根目录运行执行以下命令
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.
注:#
后的语句为注释。它不属于命令&执行命令时应该排除。