734 B
734 B
Git
Add to ~/.bashrc
:
[[ -f /usr/share/git/completion/git-completion.bash ]] && \
source /usr/share/git/completion/git-completion.bash
[[ -f /usr/share/git/completion/git-prompt.sh ]] && \
source /usr/share/git/completion/git-prompt.sh
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
Prefer rebase when pull:
git pull --rebase
Clean outdated branches:
git fetch --prune
Push force safely:
git push --force-with-lease
Save usernames and passwords in ~/.git-credentials
:
git config --global credential.helper store
Use neovim when commit:
git config --global core.editor nvim
Rewrite history by changing last x
commits :
git rebase -i HEAD~x