Part-4 Basic Git Commands That Everyone Should Know

Part-4 Basic Git Commands That Everyone Should Know

Let’s make a well articulated and documented "cheat-sheet" with all the commands you learned so far in Git-GitHub.

Git Command

Let us open Git Bash and run some Git commands

1. $ git init “[repository-name]”

2. $ git --version

3. $git config --global user.name "Ritul"

4. $git config --global user.email ""

5. $ git status

6. $ git add . or git add [filename]

7. $ git commit -m "message"

8. $ git log

9. $ git show <commit-id>

10. $ git remote add origin <centralgit URL>

11. $ git remote -v

12. $ git push -u origin master

13. $ git log -1

14. $ git log -2

15. $ git log --oneline

16. $ git branch

17. $ git branch <branch name>

18. $ git checkout <Name of the branch you want to go>

19. $ git branch -d <branch-name>

20. $ git branch -D <branch-name>

21. $ git merge <branch name>

22. $ git stash

23. $ git stash list

24. $ git stash apply stash @ {0}

25. $ git stash clear

26. $ git reset .

27. $ git reset --hard

28. $ git revert <commit-id>

26. $ git clean -n

27. $ git clean -f

28. $ git tag

29. $ git show <tag-name>

30. $ git tag -d <tagname>

Finally Completed Git!! 🎉

Happy Learning :)

~Ritul Gupta