Skip to content

Latest commit

 

History

History
35 lines (35 loc) · 626 Bytes

git.md

File metadata and controls

35 lines (35 loc) · 626 Bytes

remote

add

git remote set-url origin --push --add <a remote>

change

git remote set-url origin repo_url

list

git remote -v

fetch all branches

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done

__

stash

not pushed commit

git reset --soft HEAD^
git stash

pushed commit

stash

git reset --soft HEAD^
git stash
git pull
git stash pop # Will cause a conflict
git commit    # Re-commit 7826b2

cherrypick

git reset --hard HEAD^
git pull
git cherry-pick 7826b2 # Will cause a conflict