Git is widely used version control system for managing source code and enhance collaboration. Most important thing to take care while working with git is that you must be aware of branch you are working on, so that you don't accidentally make changes in wrong branch of your repository. This tricky in terminal as it doesn't show git branch name. We can customize terminal in such a way that it shows current branch name of repository you are working on and reduces chances of making changes to wrong branch to great extent. Here is how to do that: Open bashrc file. Now in opened bashrc file find and uncomment the line force_color_prompt=yes Then add the following after that line: so now the terminal is ready to greet you with colors and git branch name. Just save the file by pressing control + x and reopen terminal.
Remember, in above code in line PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033$ 01 is to make font bold, 32 is color code for green. You can change this by the color codes you get from this link . Hope this will be useful and you won't be committing in wrong branches after this! Would like hear from you about this post. |
AuthorHi, I am Parth Modi. I am software developer. I like to work in Ruby on Rails and Java. Archives
October 2016
CategoriesAll Aws-tutorials Git Github Pages Json Linux Rails API Ruby Ruby On Rails Tutorials |