Git Basic Commands

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

https://www.hostinger.

com/tutorials/basic-git-commands
https://www.freecodecamp.org/news/10-important-git-commands-that-every-developer-should-
know/

git –version: to check git version


1. To set your username
git config --global user.name "FIRST_NAME LAST_NAME"
2. To set your email
3. git config --global user.email "MY_NAME@example.com"
Working with GIT commandline
Initializing a local repository:
git init
This command will initialise our local repository.
Checking status of the repository:
As you can see a .git file is created as mentioned above. Now to check the status of these files,
the following command is used:
git status
Adding files to the repository:
Now in the previous step we have seen that some files are untracked, with the help of git add
filename we add these files to the staging area. git add command is used to add all files in the
folder to the staging area
git add
Committing changes:
Now files are ready to be committed they are ready to be added to the local
repository
git commit -m "your message"
git commit command allows you to add your files to your local repository -
m specifies that you have to pass commit message while committing a code

Parallel development commands


git branch branch_name
This command allows to create a branch for the project. A branch is like exact
copy of the project.
git checkout branch_name
This command allows to switch from one branch to another.
git merge branch_name

You might also like