Reset origin to commit
git log
git reset --hard <commit-hash>
git push --force origin master
Add images to README.md
git checkout --orphan images
git rm -rf .
cp /path/to/the/image/image.jpg .
git add .
git commit -m "Add image.jpg into images branch"
git push origin images:images
git checkout master
Edit your README.md
and add:
![alt text](../images/image.jpg?raw=true)
or full link (not recommended):
![alt text](https://github.com/YOUR_ACCOUNT_NAME/REPOSITORY_NAME/blob/images/image.jpg)
Show last 10 commits in table format
git log --pretty=format:"%h - %an, %ar : %s"|head
Merge all commits in branch into one
git checkout master
git merge --squash somefeature
git commit -m 'merged somefeature'
git push
Rename remote branch
git branch -m old new
git push origin :old
git push --set-upstream origin new
Delete local branches that do not exist remotely
git checkout master; git fetch -p; git branch -vv | grep ": gone]" | awk '{ print $1 }' | xargs git branch -d
Delete remote tag
git push --delete origin tag_name
Remove file from all commit
git filter-branch --prune-empty --tree-filter 'rm -f FILE' HEAD