This write-up will explain:
- How to Display the Current Branch in Terminal?
- How to Display the Current Branch and Folder/File Path in Terminal?
How to Display the Current Branch in Terminal?
To only display the current working branch name in the Git terminal, type out the “cd” command with the Git root directory path and navigate to it:
Now, run the “git branch” command along with the “–show-current” option:
As you can see, the below-given output shows the name of the current working branch name:
How to Display the Current Branch and Folder/File Path in Terminal?
If you want to view the name of the current working branch and folder/file path in the Git terminal, the “git status” provided command can be used:
According to the below-given output, the “gemma” is the current working branch and all staged/unstaged files are displayed with their folder path:
That’s all! We have described the easiest way of showing the current working branch and file/folder path in the Git terminal.
Conclusion
To show the current working branch and file/folder path in the Git terminal, first, redirect to the Git root directory and execute the “git branch –show-current” to just view the branch name. If developers want to check the current branch name with the file/folders name, then use the “git status” command. This write-up illustrated the way of displaying the current branch and file/folder path in the Git terminal.