Sample Header Ad - 728x90

Display git branch in terminal

3 votes
2 answers
3398 views
I am using fedora OS and I want to display git branch or tag in terminal when I go into the git folder project. I follow [this tutorial](https://fedoraproject.org/wiki/Git_quick_reference#Display_current_branch_in_bash) . After I ran: source /usr/share/git-core/contrib/completion/git-prompt.sh source ~/.bashrc It displays the git branch well. But if I run: cd .. #I go back the parent folder which is not git folder It keeps the git branch. How can I fix it?
Asked by GAVD (181 rep)
Mar 18, 2018, 05:32 PM
Last activity: Apr 30, 2025, 03:07 PM