【问题标题】:directory deleted in different branch doesn't show even in master branch in git即使在 git 的 master 分支中,在不同分支中删除的目录也不会显示
【发布时间】:2020-08-17 00:54:36
【问题描述】:

我正在通过教程学习 git 命令。我有一个疑问:

在一个目录中,我想让 git 兼容:

git init
git add .
git commit -m "initial commit of full repository"
git remote add origin bitbucket_URL
git push -u origin --all
git checkout -b feature/feature1
git rm README.txt
git add .
<didn't commit>
ls => doesn't show README.txt
git checkout master
ls => it also doesn't show README.txt 

但是我已经从 feature1 分支而不是 master 中删除了 README。为什么 README 没有出现在 master 分支的 ls 中

PS: 但是当我在添加 feature1 分支后提交然后切换到 master 分支然后执行 ls 时,就会出现 README 文件。有人可以解释一下下面发生了什么

【问题讨论】:

  • 但是当我在添加 feature1 分支后提交然后切换到 master 分支然后执行 ls 时,就会出现 README 文件。有人可以解释一下下面发生了什么......
  • 当你 git checkout 某个其他分支时,你可以携带未提交的更改。详情见stackoverflow.com/q/22053757/1256452

标签: git github bitbucket


【解决方案1】:

在您提交之前,更改悬而未决。你搬到了 master,随之而来的变化......不是错误,而是一项功能(您有多少次开始在错误的分支上工作?或者在不同的分支上测试了一些更改而无需提交移动?嗯,你去!!!)。

【讨论】:

    猜你喜欢
    • 2021-04-15
    • 1970-01-01
    • 2018-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多