-
Notifications
You must be signed in to change notification settings - Fork 0
Git
git rm -r --cached .
git add .
git commit -m <message>
git rebase -i HEAD~<number of commits>
git push -f
git checkout <deleting_commit>^ -- <file_path>
git remote prune origin --dry-run
git remote prune origin
git branch --merged | egrep -v ^[*] | egrep -v master$ | xargs -r git branch -d
git checkout <commit hash> -- file1/to/restore file2/to/restore
git checkout <commit hash>~<number of commits to rollback> -- file1/to/restore file2/to/restore
git checkout HEAD~<number of commits to rollback> -- file1/to/restore
%UserProfile%\.gitconfig
[alias]
cm = !sh -c 'git fetch && git checkout master && git pull'
gone = ! "git branch --merged | egrep -v ^[*] | egrep -v master$ | xargs -r git branch -D && git remote prune origin && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}' | xargs git branch -D"
- Use git hooks to run some scripts before actually committing.
#!/bin/sh
set -v
npm run lint-src-fix
if [ $? -ne 0 ]; then
exit 1
fi
git add -u
--verbose
if [ $? -ne 0 ]; then
exit 1
fi
git config --global pull.rebase true