Give the output in an easy-to-parse format for scripts. Show the branch and tracking info even in short-format. There are many commands which are useful some of them are -s It will tell you on which branch you are on You can use git bash on the working directory to write the current commit in human-readable form. If it doesn't start with 'ref: ', then it is detached HEAD (anonymous branch), pointing directly to some commit. Strip this prefix to get full name, and strip refs/heads/ to get short name of the current branch: b="$" git/HEAD is symref (symbolic reference), and we are on normal branch. This usually happens if the repository is bare. If this file doesn't exist, then there is no current branch. git/HEAD file is a symbolic link (a very rare case, from the ancient history of Git), it uses git symbolic-ref HEAD 2>/dev/nullĮlse, it reads. Git uses unnamed branch (detached HEAD) during the rebase process to make it atomic, and original branch is saved elsewhere. How git-prompt.sh from contrib/ does it (git version 2.3.0), as defined in _git_ps1 helper function:įirst, there is special case if rebase in progress is detected. Why not use git-aware shell prompt, which would tell you name of current branch? git status also helps. (FYI this was done with git version 1.8.3.1)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |