Till now in this course we have installed Git on our systems and as we already know, we will be using Git Bash in this complete course. We have understood the concept and terminologies used in Git and it is time now that we start using Git Bash and do some practical stuff.
In this tutorial, we will focus on
- What is Git Help?
- How to list all the Git Commands
- How to get help on particular command?
- How to open Git official doc help from Git Bash?
What is Git Help?
Like any other software’s help option, Git Help is also an option in the Git to get help for the new beginners like you. Git does not have an option field or command. Git Help can be accessed from your Git Bash just by typing the command git help.
Press Enter to execute the help command.
This command will display all the information about Git. These are brief information to get any beginner started. These commands as shown above are the most common commands used in Git. These are just some brief intro though, we will see all the available commands in next section.
How to List all the Git Commands?
The command used in the last section i.e. git help is the larger command if I must say. This can be used to get more specific results and more specific commands according to us.
If we need to see all the available commands in Git, we need to use the following command.
git help -a or git help – -a
Note: One is with single ‘-‘ and other is with double but no space between ‘- -‘
Press enter to execute the command
This will show you all the available commands in the Git. If you scroll till the end after the command you will three line information. This is constant no matter what command you execute.
Note: The same command i.e. git help -a is similar to git help –all command. You can try that out too. The result will be similar.
It is also noteworthy that git bash will suggest you the correct command in case you enter a wrong command. For example, let us try to execute the command git help -all in git bash and see what happens.
It tells us that maybe we wanted the command to be with two dashes. Now let’s move onto the next section and explore a bit more.
How to access Help on particular Command?
It is very easy to get the help on one particular command. In the above section we listed all the available commands in git and there can be cases where you either don’t know a particular command and want to know about it or you know a command name and want to know the syntax. Whatever be the case, the following steps will tell you about the particular command.
1.List all the commands using git help -a
2. Choose any command from the option, here I am choosing fetch.
3. Type the following command with your chosen command
git help <command name>
4. Press enter and the “fetch” manual will open up in your browser.
This page will contain every information about the command you typed. The information until now is enough for any beginner to just start and try brushing some commands. In the next section we will show you how to get official doc help in git bash.
How to access Git Guide from Git Bash?
In the previous section we showed that when you scroll to the end of the result (of the command you execute), an option is there.
This option is git help -g. This command, as shown above, will show you some concept guides. These guides will help you get started in you journey through git. Let’s explore this command.
Enter the command git help -g
Press enter to execute the command
This will show you the common Git guides available. You can also see the summary in front of the guide name. For example the guide named “attributes” defines the attributes in git per path. The guide “everyday” will have the commands used commonly etc.
To open any specific guide, type the following in the git bash
git help <guide_name>
Press enter to execute the command. This will open the manual about attribute in your browser just like it opened above about fetch.
So by this we have come to the end of this tutorial. I hope you have something now to spend time on git bash. Keep practicing all these commands through hit and try. We will move onto our next tutorial now.