Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shotaK/82a9be175363d5cea90d to your computer and use it in GitHub Desktop.
Save shotaK/82a9be175363d5cea90d to your computer and use it in GitHub Desktop.
Git
git init
git add .
git commit -m 'First commit'
git remote add origin remote repository URL
git remote -v
git pull origin master
git push origin master
git checkout -b myFeature develop
git branch -D <branch-name>
git push origin --delete <branch-name>
git remote prune origin
git branch | grep 'sh' | xargs git branch -d
git checkout -- .
git clean -f
git reset --hard
git fetch
git checkout <branch-name>
// Add files and folders to .gitignore
git commit -m ".gitignore is now working"
git rm -r --cached . // or
git rm --cached filename
git add .
git checkout master
git pull origin master
git merge test
git push origin master
git push origin <branch-name>
// remove all commits until HEAD/Last merge
git reset --hard HEAD~1
// remove specific commit
git reset --hard <sha1-commit-id>
// push removed commits to remote branch
git push origin HEAD --force
git checkout master
git pull origin master
git merge sh-develop
git diff --name-only --diff-filter=U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment