git add <file1> <file2> ... Add the specified file to the staging areagit add <dir> Add the specified directory to the staging area, including subdirectoriesgit add . Commit all modified and new data staging areasgit add -u commits all deleted and modified files to the staging areagit add -A commits all deleted, replaced, modified and new files to the staging areagit rm <file1> <file2> ... Delete files from the workspace and staging area at the same timegit rm --cached <file1> <file2> ... Delete the file from the staging area, but the workspace file still existsgit rm -r <dir-name> Delete a foldergit mv <file-from> <file-to> rename files and add new files to the staging areagit stash Create a new stashgit stash save "<stash-name>" Create a new temporary store and name itgit stash -u/--include-untracked Create a new temporary store (with untracked changes)git stash list List all temporary stashesgit stash show Browse temporary storage contentsgit stash show -p Browse temporary storage differencesgit 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 storesgit commit -m <message> Commit the stash to the local repositorygit commit <file1> <file2> ... -m <message> Commit the specified files from the staging area to the local repositorygit 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 addgit commit --amend [-m] [new-message] modify the commit recordgit commit -v Show all diffs to be added to the local repositorygit stash
git checkout branch2
git stash pop