Pull from remote overwriting local changes.
i) git stash (revert and stash changes locally)
ii) git pull (pull from remote normally)
tip: to retrieve changes, do 'git stash apply'
Delete only untracked files from working tree
git clean -f -dUnstage files from index (but keep the files locally)
git rm --cachedUndo a merge
i) git checkout branch-name
ii) git log --oneline
iii) git revert -m commit-idRemove a file from remote
i) git rm filename (remove file from git)
ii) git commit -m "commit message"
iii) git pushUndo last n commits
git reset --soft HEAD^n (where n is the number of last commits you want to undo)See diff between branches
git diff branch_1..branch_2Remove a tag from branch
i) git push origin :refs/tags/tagname
ii) git tag -dRename a branch locally & remote
i) git checkout old-branch
ii) git branch -m new-name
iii) git push origin :old-name new-nameMove existing, uncommitted work to a new branch
git switch -c (git 2.3 onwards)
Top comments (0)