Skip to content

Instantly share code, notes, and snippets.

@blueskyarea
Last active April 19, 2021 16:15
Show Gist options
  • Save blueskyarea/b90735191f79756f006e to your computer and use it in GitHub Desktop.
Save blueskyarea/b90735191f79756f006e to your computer and use it in GitHub Desktop.
git-command
// add remote repository to local git
git remote add origin {remote repository url}
// pushes up the all repository
git push -u origin --all
// pushes up any tags
git push -u origin --tags
// cancel one before commit
git reset --soft HEAD~
// delete remote branch(foo)
git push origin :foo
// create zip file from git repository
git archive [HEAD|tag|branch|commit] --output=hoge.zip
// cancel merge before fixing any conflict
git merge --abort
// cancel merge while fixing any conflict
git reset --hard HEAD
// cancel merge after commit
git reset --hard ORIG_HEAD
// show diff on HEAD
git show
// show diff on commitA
git show commitA
// show log between tag v10 and tag v20
git log v10..v20
// remove branch which was removed from remote
git fetch origin --prune
// removev tag which was removed from remote(1), depends on git version
git fetch origin --prune --tags
// removev tag which was removed from remote(2), depends on git version
git fetch origin --prune 'refs/tags/*:refs/tags/*'
// removev tag which was removed from remote(3), on all git version
git tag -l | xargs git tag -d
git fetch origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment