• git add <file1> <file2> ... Add the specified file to the staging area
  • git add <dir> Add the specified directory to the staging area, including subdirectories
  • git add . Commit all modified and new data staging areas
  • git add -u commits all deleted and modified files to the staging area
  • git add -A commits all deleted, replaced, modified and new files to the staging area
  • git rm <file1> <file2> ... Delete files from the workspace and staging area at the same time
  • git rm --cached <file1> <file2> ... Delete the file from the staging area, but the workspace file still exists
  • git rm -r <dir-name> Delete a folder
  • git mv <file-from> <file-to> rename files and add new files to the staging area
  • git stash Create a new stash
  • git stash save "<stash-name>" Create a new temporary store and name it
  • git stash -u/--include-untracked Create a new temporary store (with untracked changes)
  • git stash list List all temporary stashes
  • git stash show Browse temporary storage contents
  • git stash show -p Browse temporary storage differences
  • git stash pop restore the last temporary storage (delete temporary storage)
  • git stash apply Restore the last temporary storage (keep temporary storage)
  • git stash apply stash@{n} restores a specific store to the current branch (n = stash list number)
  • git stash <pop|apply> stash@{n} apply a specific stash (n = stash list number)
  • git stash drop stash@{n} Delete a specific temporary store (n = stash list number)
  • git stash clear Delete all temporary stores
  • git commit -m <message> Commit the stash to the local repository
  • git commit <file1> <file2> ... -m <message> Commit the specified files from the staging area to the local repository
  • git commit -am <message> You don’t need to run the git add command to commit the specified files in the staging area to the local repository, it only works for modifying and deleting files, new files still need to be git add
  • git commit --amend [-m] [new-message] modify the commit record
  • git commit -v Show all diffs to be added to the local repository
  • Move uncommitted changes from the current branch to another branch
    git stash
    git checkout branch2
    git stash pop