A quick reference guide for essential Git commands, covering basic to advanced operations.
This document serves as a quick reference guide for essential Git commands, providing a comprehensive overview of basic to advanced operations. It covers everything from initializing a repository and managing branches to committing changes and interacting with remote repositories. This guide is designed to be a helpful resource for both beginners and experienced users who need a quick reminder of Git’s powerful features.
download github desktop
https://desktop.github.com/download/
set up github account
https://github.com/
Clone a repository into a new directory
git clone
Initialize a new Git repository
git init
Add to the staging area
git add
Commit changes to the repository
git commit -m “commit message”
View the commit history
git log
Check the status of changes
git status
Show the changes in the working directory
git diff
Create a new branch
git branch
List all branches
git branch
Switch to a different branch
git checkout
Create and switch to a new branch
git checkout -b
Merge a branch into the current branch
git merge
changes from a remote repository
git pull
Push changes to a remote repository
git push
Delete a branch
git branch -d
Stash changes
git stash
Apply stashed changes
git stash apply
Show stashed changes
git stash list
Remove a file from the staging area
git reset
reset to the last commit with commit id but keep your actual file unchange
git reset –soft HEAD~1
reset to the last commit with commit id
git reset –hard e4a59dd6b356b93f914db2a2a253dc55582bd61e