git branch | wc -l
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
git commit --amend --date="$(date -R)"
This will trigger a git commit --amend
action
git commit --amend --author="Puncoz Nepal <info@puncoz.com>"
This will trigger a git commit --amend
action
gcf
This works on ZSH shell
git rev-list --count HEAD
git rev-list --count <branch-name>
git rev-list --count HEAD ^<branch-name>
git rebase -i HEAD~5
git rm -r --cached <file>
git add -u
git checkout <branch-name>
or,
git switch <branch-name>
git checkout <path-to-file>
or,
git restore <path-to-file>
For files
$ git clean -f
For Directories
$ git clean -d
If you are on the branch you want to rename:
git branch -m new-name
If you are on a different branch:
git branch -m old-name new-name
git push origin :old-name new-name
Switch to the branch and then:
git push origin -u new-name
git shortlog -s -n
// Fetching all branches and tags from old repo
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all`
git pull --all
// Pushing into new repo with remote name new-repo
git push -u new-repo --all
git push -u new-repo --tags
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
git add .gitignore
git commit -m "removed .DS_Store"
git rev-parse HEAD
or,
git rev-parse --verify HEAD
git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"%s" --no-merges
git push --force-with-lease