Quick Github cheat sheet:

Sumanta Mukhopadhyay
2 min readMar 1, 2023

--

  • git clone [repository url]: This command is used to copy a remote repository to your local machine.
  • git status: This command is used to check the current status of the repository, including any changes that have been made but not yet committed.
  • git add [file or folder name]: This command is used to stage changes for the next commit.
  • git commit -m "[commit message]": This command is used to save changes to the local repository with a descriptive message.
  • git push origin [branch name]: This command is used to upload local changes to a remote repository.
  • git branch [branch name]: This command is used to create a new branch.
  • git checkout [branch name]: This command is used to switch to a different branch.
  • git merge [branch name]: This command is used to merge changes from one branch into another.
  • git log: This command is used to view a log of all previous commits.
  • git revert HEAD: This command is used to undo the last commit.
  • git stash: This command is used to temporarily save changes that have not yet been committed.
  • git stash apply: This command is used to apply changes that were previously stashed.
  • git stash list: This command is used to view a list of all stashes.
  • git stash drop: This command is used to discard a stash.
  • git diff [branch1] [branch2]: This command is used to show differences between two branches.
  • git reset [commit hash]: This command is used to reset a branch to a specific commit.
  • git revert [commit hash]: This command is used to revert changes made in a specific commit.
  • git fetch: This command is used to retrieve changes from a remote repository without merging them into the local repository.
  • git pull: This command is used to retrieve changes from a remote repository and merge them into the local repository.
  • git remote -v: This command is used to view details of remote repositories.
  • git tag [tag name]: This command is used to create a tag.
  • git push origin [tag name]: This command is used to upload a tag to a remote repository.

--

--

Sumanta Mukhopadhyay
Sumanta Mukhopadhyay

No responses yet