0% found this document useful (0 votes)
22 views2 pages

Essential Git Commands Cheat Sheet

This document is a cheat sheet for GitHub commands, providing a list of essential commands and their functions. It includes commands for initializing repositories, managing branches, committing changes, and interacting with remote repositories. Each command is briefly described to assist users in using Git effectively.

Uploaded by

aprashant0012
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Essential Git Commands Cheat Sheet

This document is a cheat sheet for GitHub commands, providing a list of essential commands and their functions. It includes commands for initializing repositories, managing branches, committing changes, and interacting with remote repositories. Each command is briefly described to assist users in using Git effectively.

Uploaded by

aprashant0012
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

GITHUB COMMANDS CHEAT SHEET

1. git init
Initialize a new Git repository in the current directory.
2. git clone
Download a repository from GitHub to your local system.
3. git status
Check the current state of the working directory and staging area.
4. git add
Add a file to the staging area.
5. git add .
Add all modified files to the staging area.
6. git commit -m "message"
Save staged changes with a message.
7. git push
Upload commits to the remote repository.
8. git pull
Download and merge updates from the remote repo.
9. git fetch
Download updates but do not merge them automatically.
10. git branch
List all branches.
11. git branch
Create a new branch.
12. git checkout
Switch to another branch.
13. git checkout -b
Create and switch to a new branch.
14. git merge
Merge another branch into the current one.
15. git remote -v
Show linked remote repositories.
16. git remote add origin
Link your local repository to a GitHub repo.
17. git reset --hard
Remove all changes and reset to last commit.
18. git revert
Create a new commit that undoes the specified commit.
19. git log
Show commit history.
20. git stash
Save uncommitted changes temporarily.
21. git stash pop
Restore stashed changes.
22. git tag
Create a tag for a commit.
23. git diff
Show differences between files.
24. git rm
Remove a file from the repository.
25. git config --global [Link] ""
Set your Git username.
26. git config --global [Link] ""
Set your Git email.
27. git restore
Discard changes in a file.
28. git show
Display details for a commit.
29. git clean -f
Delete untracked files.
30. git blame
See who last modified each line in a file.

You might also like