简体   繁体   English

新提交的Git分支未显示

[英]Newly committed Git branch is not showing

I'm having an issue with Git, I've switched to a new branch and committed my changes but the new branch is not showing up in the list of branches. 我在Git上遇到问题,我已经切换到新分支并提交了更改,但是新分支未显示在分支列表中。

git checkout -b new-branch
git branch
 develop
 *new-branch
git commit -am 'new message'
git push -u origin new-branch
git branch -a
[here the new branch does not show]
git checkout origin/new-branch
error: pathspec 'origin/new-branch' did not match any file(s) known to git.

Is there a step I'm missing? 我缺少步骤了吗?

I think I may have found the answer, I needed to update my remotes list 我想我可能已经找到了答案,我需要更新遥控器列表

git remote update

But this also could have been that I had not added any files to the latest commit. 但这也可能是因为我没有向最新提交中添加任何文件。 You can check which files are to be committed using 您可以使用来检查要提交的文件

git status

Then if you want to add everything that is not ignored by .gitignore then you can simply run this from your code root. 然后,如果要添加.gitignore不能忽略的所有内容,则可以从代码根目录简单地运行它。

git add .

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

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