gpt4 book ai didi

git - 如何在 git 中将更改从 master merge 到我的分支

转载 作者:太空狗 更新时间:2023-10-29 14:41:23 25 4
gpt4 key购买 nike

我错误地在 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.

注意:#后的语句是注释。它不属于命令&执行命令时应排除。

关于git - 如何在 git 中将更改从 master merge 到我的分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55156080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com