![](/img/trans.png)
[英]GIT: Commit only some changes to current branch and the rest to a new branch
[英]Change current branch and commit to a new branch in Git
我已经通过bitbucket在Git中手动创建了一个新分支(C)。 现在我想将更改从分支A推送到分支C。
我现在在目录A上,提交并推送了对该分支的更改。
directoryA > git status
On branch A
Your branch is up-to-date with 'origin/A'.
nothing to commit, working directory clean
现在我去了目录B。当我执行git status
它已连接到分支B,但我希望将此目录连接到分支C。
directoryB > git status
On branch B
Your branch is up-to-date with 'origin/B'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: config/development.json
no changes added to commit (use "git add" and/or "git commit -a")
所以我应该做git fetch && git checkout C
停留在directoryB中,然后提交并推送。
请提出建议。 非常感谢您的帮助。
您是否尝试过您建议的功能。 为了清楚起见,再次提供详细信息
git fetch && git checkout C
git commit -am "what ever message you want to put"
上述命令将提交.gitignore,config/development.json
,您可以直接推送到远程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.