1.0 KiB
1.0 KiB
- Update all Git repos in your current directory
ls | xargs -I{} git -C {} pull
- Pull from remote overwriting local changes.
git stash(revert and stash changes locally)git pull(pull from remote normally)- TIP: To retrieve changes, do
git stash apply
- Delete only untracked files from working tree
git clean -f -d
- Unstage files from index (but keep the files locally)
git rm --cached
- Undo a merge
git checkout branch-namegit log --onelinegit revert -m commit-id
- Remove a file from remote
git rm filename(remove file from git)git commit -m "commit message"git push
- Undo last "n" commits
git reset --soft HEAD^n
- See diff between branches
git diff branch_1..branch_2
- Remove a tag from branch
git push origin :refs/tags/tagnamegit tag -d
- Rename a branch locally and remote
git checkout old-branchgit branch -m new-namegit push origin :old-name new-name
- Move existing, uncommitted work to a new branch
git switch -c <new-branch>