# Git commands ## init local repository `git init` ## add changes to stage in the local `git add ` ## add all changes in the local `git add .` ## commit changes to new commmit object being ready for remote repository `git commit -m ""` ## amend last commit message `git commit --amend -m ` ## push the committed changes to the remote repository `git push ` ## pull changes in the remote repository `git pull ` ## list all branches `git branch` ## switch to the selected branch `git checkout ` ## create a new branch and swich to it `git checkout -b ` ## remove local branch `git branch -d ` ## remove remote branch `git push origin --delete ` ## set upstream for a local branch `git branch --set-upstream-to=origin/ ` ## update local repository with remote branch references `git fetch` ## restore working tree files in the current directory `git restore .` ## save the current changes in stash `git stash` || `git stash save "some comment to the changes"` ## display all stashed changes `git stash list` ## display changes of selected stash `git stash show -p ` ## apply stashed changes but keep the stashed `git stash apply ` ## apply stashed changes and delete the stashed `git stash pop ` ## delete selected stashed changes `git stash drop ` ## delete all stashed changes `git stash clear` ## reset to a certain commit with soft `git reset --soft ` ## reset to a certain commit with hard `git reset --hard ` ## force push with reset local branch `git push --force-with-lease origin ` ## ignore file `git update-index --assume-unchanged ` ## undo ignore file `git update-index --no-assume-unchanged `