git - 更改当前分支并提交到 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
留在目录B然后提交和推送。
请建议。非常感谢任何帮助。
解决方案
您是否尝试过您建议的方法,它会起作用。要清楚再次提供详细信息
git fetch && git checkout C
git commit -am "what ever message you want to put"
上面的命令将提交.gitignore,config/development.json
,您可以推送到远程。
推荐阅读
- windows - Fluentbit 创建 TCP 连接
- r - ggfortify 无法加载 - U_FILE_ACCESS_ERROR
- vb.net - VB。NET 印刷标签
- java - 我试图在我的 xhtml 页面中调用我的 JSF 组件,但它无法识别它显示为文本?
- sql - 按条件分组的 ROW_NUMBER()
- kubernetes - 全新安装 okd 后,无法部署容器给出错误文件不存在 memory.limit_in_bytes
- c# - 整套单元测试用例通过但如果我单独运行它会失败
- .net - Axios GET 请求耗时过长
- python - 将数据集写入 Json 文件时,仅打印数据集获取的最后一个值
- python - 通过 OpenCV 模板匹配重复图像输出