Skip to content

Git

Git Commands

1 git add ↳ It lets you add changes from the working directory into the staging area

2 git commit ↳ It lets you save a snapshot of currently staged changes in the local repository, with a message

3 git push ↳ It lets you upload commited changes from the local repository to a remote repository

4 git fetch ↳ It lets you download changes from a remote repository, without applying them locally

5 git merge ↳ It lets you combine changes from one branch into another

6 git pull ↳ It lets you fetch and then merge changes from a remote repository into the local branch

7 git diff ↳ It lets you see the changes not staged or commited yet

8 git diff HEAD ↳ It lets you see changes between the current working directory and the latest commit

9 git status ↳ It shows you the current state of the working directory and staging area

10 git branch ↳ It lets you see all local branches

11 git checkout ↳ It lets you create a branch or switch between branches

12 git log ↳ It shows you commits in the current branch with extra details

13 git stash ↳ It lets you temporarily save uncommited changes and apply them later

14 git rebase ↳ It lets you apply commits from one branch to another

15 git reset ↳ It lets you undo changes in the working directory and move back to a specific commit

16 git revert ↳ It lets you undo changes by creating a new commit

17 git cherry pick ↳ It lets you apply commits from one branch to another

  • Working directory ↳ It’s the directory where you make changes to the files

  • Staging area ↳ It lets you control which changes go into a commit

  • Local repository ↳ It’s the version of a project stored on the local machine of a user

  • Remote repository ↳ It’s the version of a project stored on a server, such as GitHub