git init
This command creates the new Git repository. It can be used to convert an existing project to a Git repository or initialize a new, empty repository.
git add .
This command adds all the files that you are going to commit. You can also add specific file from your directory with command git add specific file
.
git branch
This command shows the branch that you have created. Using git branch branch_name
you can create new branch and git status
shows the branch that you are currently working on.
git checkout
This command let you to move from one branch to another. If you are in master
branch and want to move in main
branch you can use git checkout main
to move in main branch.
git clone
This command clone or make a copy of repository locally. To clone a repository, you can use git clone repository_url
.
git commit
This command changes the source code of existing file with new changed code with the commit message. To make a good commit, we can use git commit -m"commit message"
. Commit message includes what changes you have made in file.
git merge
This command lets you to merge or sync changes that you have made in main branch.
git push
This command push the file to the repository. If you have some file where you have made changes , you can push those file into repository by using git push
.
git pull
This command pull the file from the repository to our local workspace. If some changes is made in repository and you want to pull those changes, then git pull
is used.
git log
This command shows the commit you have made. It displays the changed information like whether the commit is merged or not , who have made the commit and date,time when the commit is made.
Thanks for reading.