The git commands that are useful to me, yet I couldn’t remember

git remote update origin — prune # remove branches that are no longer available in origin

git merge — squash <branch> # merge all commits as one commit

git merge <tag/branch> — no-commit # merge without auto commit

git clone https://<username>:<password>@github.com/<username or institution name>/<repository>.git # clone the repository providing username and password. The field <password> is optional. Without it, the shell prompts for the password.

git gc # git garbage collection

git clone — depth <# of depth> <URL of git repository>.git # shallow clone

git fetch — unshallow # unshallow

git pull — unshallow

git pull — depth <# of depth> # shallow pull the current branch

git log — follow <file> # show change history of the file

git show <commit> # show commit’s message/metadata.

git branch -r | awk ‘{print $1}’ | egrep -v -f /dev/fd/0 <(git branch -vv |grep origin) | awk ‘{print $1}’ | xargs git branch -d

--

--