1. Git Merge
Git merge allows you to combine work from two branches into one.
git merge <branch>TIPUse
git mergeto integrate changes from one branch into another, typically the main branch.
2. Git Diff
Git diff shows the differences between any two commits or files within your Git repository.
git diff <source branch> <target branch>3. Git Log
The git log command lists all commits in your project history.
git logNOTEUse options like
--onelineor--graphto simplify or visualize the log.
4. Git Show
Git show displays the details of a specific Git object (e.g., commit, tag, or tree).
git show <commit>5. Git Grep
Git grep searches your codebase for occurrences of a specific string or pattern.
git grep -n <pattern>6. Git Branch
Create or list branches in your repository.
git branchTIPUse
git branch -d <branch>to delete a branch.
7. Git Push
Push your local commits to a remote repository.
git push -u <remote> <branch>8. Git Stash
Save changes temporarily without committing them.
git stashIMPORTANTRemember to run
git stash popto reapply your stashed changes.
9. Git Rebase
Update a branch by applying commits on top of a base branch.
git rebase <base>CAUTIONEnsure you’re aware of the difference between
rebaseandmergeto avoid unwanted history rewrites.
10. Git Config
Set or get global or repository-specific options.
git config --global user.name "Your Name"git config --global user.email "<youremail@example.com>"11. Git Clone
Clone an existing repository to your local machine.
git clone <repository>12. Git Init
Create a new Git repository.
git init13. Git Checkout
Switch between branches or restore files.
git checkout <branch>14. Git Reset
Reset your current HEAD to a specific commit.
git reset <commit>15. Git Tag
Manage tags in your repository.
git tagTIPUse
git tag -a <tag>to create an annotated tag.
16. Git Archive
Create an archive of files from a specific commit or branch.
git archive17. Git Commit
Record changes to the repository.
git commit -m "Commit message"18. Git Status
Display the working tree status.
git status19. Git RM
Remove files from the working tree and index.
git rm <file>20. Git Remote
Manage a set of tracked repositories.
git remote add <name> <url>21. Git Instaweb
Launch a local web-based Git repository viewer.
git instaweb22. Git Notes
Add extra information to commits.
git notes add <message>23. Git Bisect
Debug your repository by locating a problematic commit.
git bisect24. Git Submodules
Import other repositories as submodules.
git submodule add <repository>25. Git Bugreport
Compile a bug report with system and repository information.
git bugreport26. Git Fsck
Verify the integrity of your repository and recover unreachable objects.
git fsck27. Git Stripspace
Remove trailing whitespace from your repository.
git stripspace28. Git Hooks
Run scripts automatically in response to Git lifecycle events.
git hooks29. Git Blame
Show who last modified a line in a file.
git blame <file>30. Git LFS (Large File Storage)
Manage large files in your Git repository.
git lfs31. Git Garbage Collection
Optimize your repository by cleaning up unnecessary files.
git gc32. Git Describe
Generate a readable name for a commit based on the most recent tag.
git describe33. Git Reflog
View all Git actions performed on the repository.
git reflog34. Git Log (Enhanced)
Visualize commit logs with additional options.
git log --graph --oneline35. Git Cherry Pick
Apply a commit from another branch to your current branch.
git cherry-pick <commit>36. Git Switch
Quickly switch between branches.
git switch <branch>NOTE
git switchis a modern alternative togit checkoutfor branch switching.