git branches and commits showing on command line with ! and *

huangapple go评论59阅读模式
英文:

git branches and commits showing on command line with ! and *

问题

当我导航到我的git存储库目录时,我的命令行显示了大量信息。我习惯于它显示我的状态,例如:

在[master] <当前提交注释>

但现在,它显示了大量的信息,带有!和*以及看起来像是我的提交层次结构日志的内容。以下是它的外观(##代替敏感信息):

在![backup-master]这是我需要的修复!
![checkout]添加了##和##。这次提交可能是垃圾
* [master]合并分支'master' of /home/path/path
![oldRval]添加了顶级单元##和##
----
  - [master]合并分支'master' of /home/path/path
  * [master^2]对##和级别##的更改。修改了##增强架构
  * [master^2^]对所有##的更改,一些##,许多##
  * [master^2~2]许多原理图更改。更新了##。更新了##
  * [master~2]完成了放置更新。##完成更新和持续##错误。
  * [master~3]进行中的块
  * [master~4]对##的更新。为更清晰的布局更新到##
  * [master~5^2]对##的最终修复。分开##
  * [master~5^2^]这是我需要的修复
  * [master~6]更新了##,##和一些##与##版本
+ [backup-master]这是我需要的修复
++* [checkout]添加了XX和##。这次提交可能是垃圾
++*+ [oldRval]添加了顶级单元##和##

这似乎表明我的存储库某种方式不同步?还是这只是一个设置?我需要合并一些分支吗?提交/拉取不能解决它... 任何建议都将不胜感激。

英文:

When I navigate to the directory of my git repo, my command line shows me a lot of stuff. I'm used to it showing me my status, like

> on [master] <current commit notes

but right now, it shows a huuuuge amount of information, with !'s and *'s and what looks like a log of my commit hierarchy. Here's what it looks like (## replacing sensitive info):

on ! [backup-master] This is the fixes I need!
 ! [checkout] Added ## and ##. This commit may be garbage
  * [master] Merge branch &#39;master&#39; of /home/path/path
   ! [oldRval] Added top level cells ## and ##
----
  -  [master] Merge branch &#39;master&#39; of /home/path/path
  *  [master^2] Changes to ## and level ##. Modified ## boost architecture
  *  [master^2^] Changes to all ##, some ##, many ##
  *  [master^2~2] many schematic changes. Updated ##. Updated ##
  *  [master~2] placement update done. ## done update and ongoing ## errors.
  *  [master~3] ongoing block
  *  [master~4] Updates to ##. Updated to ## for cleaner layout.
  *  [master~5^2] final fixes on ##. Separated ##.
  *  [master~5^2^] This is the fixes I need
  *  [master~6] Updated ##, ## and some ## with ## versions
+    [backup-master] this is the fixes I need
++*  [checkout] Added XX and ## . This commit may be garbage
++*+ [oldRval] Added top level cells ## and ##

It makes it seem like my repo is somehow out of sync? Or is this just a setting? Do I need to merge some branches? A commit/pull doesn't solve it... any suggestions appreciated.

答案1

得分: 3

关于为什么在您的提示中看到这个信息,有可能是您的Shell配置(例如.bashrc.zshrc等)或您正在使用的工具已经配置为在您进入Git目录时运行git show-branch或类似的命令。通常,提示应该显示更简单的信息,比如当前分支和可能的状态。

您可以检查您的Shell配置文件(.bashrc.profile等)以查看是否有任何导致在您导航到Git目录时运行git show-branch或类似命令的内容。寻找可能修改提示的函数或别名(例如,在bash中的PS1)。


关于您的仓库是否不同步,这个输出不一定意味着您的仓库不同步,而是显示了各个分支的提交历史。如果您想查看您的分支是否落后或超前于远程分支,您可以使用git status命令。如果需要将本地分支与远程同步,您可能需要使用git fetch,然后跟着使用git mergegit rebase

您看到的输出看起来像是git show-branch命令的输出,这是一个用于一次性查看多个分支及其提交的命令。它用于查看存储库中多个分支之间的情况。

输出包括:

  • on ! [backup-master] This is the fixes I need! 表示您当前位于backup-master分支,"!" 表示这不是当前的HEAD(意味着它不是当前分支的顶端)。
  • ! [checkout] Added ## and ##. This commit may be garbage 显示另一个名为checkout的分支,"!" 表示这不是当前的HEAD。
  • * [master] Merge branch 'master' of /home/path/path 显示了master分支上的提交,"*" 表示这是当前的HEAD。
  • 带有"*"和"-"的行显示了提交的层次结构以及哪个提交是哪个提交的祖先。
英文:

Regarding why you are seeing this in your prompt, it is possible that your shell configuration (e.g., .bashrc, .zshrc, etc.) or a tool you are using has been configured to run git show-branch or a similar command whenever you navigate into a git directory. Normally, the prompt would show simpler information such as the current branch and maybe the current status.

You may want to check your shell configuration files (.bashrc, .profile, ...) to see if there is anything that causes git show-branch or a similar command to run when you navigate to a git directory. Look for functions or aliases that might be modifying the prompt (e.g., PS1 in bash).


Regarding your repository being out of sync, this output does not necessarily mean that your repository is out of sync, but it is showing the commit history of various branches. If you want to see if your branch is behind or ahead of the remote, you can use the git status command. If you need to synchronize your local branch with the remote, you might need to use git fetch followed by git merge or git rebase.

The output you are seeing looks like the output of the git show-branch command, which is a command used to see various branches and their commits all at once. It is meant for seeing what is happening among several branches in a repository.

The output includes:

  • on ! [backup-master] This is the fixes I need! means that you are currently on the backup-master branch, and the "!" indicates that this is not the current HEAD (meaning it is not the tip of the current branch).
  • ! [checkout] Added ## and ##. This commit may be garbage shows another branch named checkout, with "!" indicating that this is not the current HEAD.
  • * [master] Merge branch &#39;master&#39; of /home/path/path shows the commit on master branch, and "*" indicates that this is the current HEAD.
  • The lines with * and - show the commit hierarchy and which commit is an ancestor of which.

答案2

得分: 1

只需输入命令 "bash" 即可解决。我一定是进入了某种 git 提示符。不知道我是怎么进入的,但这就是我修复它的方式。

英文:

Simply typing the command "bash" solved it. I must have been in some kind of git prompt. No idea how I got into it, but that's how I fixed it.

huangapple
  • 本文由 发表于 2023年5月31日 23:46:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76375261.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定