| |
|
Git Commands Part2
Below are the 12 most essential Git command that we used on daily basis are explain below:-
(1)Git Config Command
We use command to configures the user. And when we say about the Git config command it is first and necessary command which is used on the Git command line. And this commands mainly sets the author name and email address which is used with your commits. And we can also used Git config in other cenarios too.
Syntax
$ git config --global user.name "crackYourInterview"
$ git config --global user.email "crackyourinterview2018@gmail.com"
(2)Git init command
We use this command to create a local repository.
Syntax
$ git init testDemo
When we say about the init command this will initialize an empty repository. And below is the screenshot when we run above commands
(3)Git clone command
We used this command to make a copy of a repository from an existing URL. And if you need a copy of any repository from GitHub, and this command allows creating a local copy of that repository on your local directory from the repository URL.
Syntax
$ git clone URL
(4)Git add command
We use this command to add one or more files to staging area(the Index).
Syntax
To add one file we use below command
$ git add Filename
And to add more than one file we use below commands
$ git add*
(5)Git commit Command
When we say about the Commit command in Git we used in two scenarios. And these are given below and syntax for this is given below
$ git commit -m
When we use above command this command will changes the head. It records or snapshots the file permanently in the version history with a message.
Syntax
$ git commit -m " Commit Message"
$ git commit -a
This command commits any files added in the repository with git add and also commits any files you've changed since then.
Syntax
$ git commit -a
(6)Git status Command
We use status command to display the state of the working directory and the staging area. This allows to see which changes have been staged and which have not in and also which files are not being tracked by Git. This will not show you any information about the commited project history. And for doing this we need to use the git log. It also lists the files that you have changed and those you still need to add or commit.
Syntax
$ git status
Git Command,Git top command,Git 12 main commands,Git Daily uses command | |
|
|
|
|