繁体   English   中英

Git Pycharm 仅将本地 master 分支更改为与 origin master 分支完全相同

[英]Git Pycharm change only the local master branch to be exactly like origin master branch

我有 2 个本地分支:“master”和“fix”。 我还有一个 origin 远程仓库,其 master 分支与我的本地 master 分支不同。

“修复”分支曾经是主分支的副本,但后来我做了很多更改:我更改了一些文件,重命名了其他文件,添加了新文件并删除了一些文件。

现在,我希望我的本地 master 分支与远程 master 分支相同 - 不更改“修复”分支!

当我使用git pull它不会从远程存储库中提取所有文件。 我不知道为什么。 当我使用git reset --hard origin/master ,它确实使本地 master 与远程 master 相同 - 这就是我想要的 - 但它也会将文件添加到“修复”分支!

  1. 为什么会这样?
  2. 如果不更改“修复”分支,我该怎么做?

在切换到master分支之前,您需要将更改提交到fix分支

#current branch: fix
git add .
git status # to verify that every thing is ready to be committed
git commit -m "your commit message"
git checkout master
# current branch: master
git status # to verify if you have commits that weren't yet pushed
git pull # add --rebase option if you have some commits not yet pushed to avoid adding merge commit

我希望它有帮助:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM