πŸ“Œ20 Git Commands you should know!

Taslima Akter Papia
2 min readNov 3, 2023

--

Git is considered a tools for managing the version history of your source code.

1) git config β€” Set your name and email in the main configuration file.

2) git init β€” Initializes a new Git repository in the current directory.

3) git clone β€” copy a git repository from a remote repository

4) git status β€” show you which file have been added to the staging area, ready to be committed.

5) git add β€” add files to the staging area, ready to commit.

6) git commit β€” commi the files to your repository, marked with a massage to remind you of the change made for each commit

7) git push/pull β€” If you have added and committed your changes and you want to push them. Or if your remote has updated and you want those latest changes.

8) git branch β€” Lists out all the branches

9) git checkout β€” Switch to different branches

10) git merge β€” Merge two branches you were working on.

11 ) git reset <file> β€” Unstages changes in a file.

12 )git commit -m β€œCommit message” β€” Commits the staged changes with a descriptive message.

13) git log β€” Displays a log of all commits in the current branch.

14 ) git checkout -b <new-branch> β€” Creates a new branch and switches to it.

15 ) git remote -v β€” Lists remote repositories and their URLs.

16) git diff β€” Shows the difference between the working directory and the last commit.

17 ) git stash β€” Temporarily saves changes that are not ready for a commit.

18) git tag <tag-name> β€” Creates a tag for a specific commit to mark significant points in the project.

19) git blame <file> β€” Shows who made changes to each line in a file and in which commit.

20) git rebase <branch> β€” Reapplies your local commits on top of another branch.

--

--