git config --global alias.up '!(git add . && git stash && git pull --rebase >&2) | grep -v "No local changes to save" && git stash pop'
git upは、必要に応じて、未承認の変更をstashに追加し、ローカルブランチを最新に更新して、ローカルの変更を復元します。 転送を含めると、最後まで未送信のローカルコミットが残り、Subversionのように履歴が線形になります。 余分なブランチを避け、コミットをマージします。
すべてが順調に進んだ場合(競合なし)、すぐにgit pushを実行できます。 まれに競合が発生する場合(あなたと誰かが同じ行を変更した場合)、rebaseが停止し、もちろん、自分でそれを把握し、git rebaseで更新を完了する必要があります。
多くの類似物がありますが、ほとんどは違法なスクリプトです。 エイリアスは、これらすべてをコンソールに貼り付けるだけで、他のサーバーと一緒に任意のサーバーに簡単に追加できます。
# git up git config --global alias.up '!(git add . && git stash && git pull --rebase >&2) | grep -v "No local changes to save" && git stash pop' # git in / git out — / pull/push git config --global alias.in '!git remote update -p; git log ..@{u}' git config --global alias.out 'log @{u}..' # git addremove - / git config --global alias.addremove \!"git add . && git ls-files --deleted | xargs --no-run-if-empty git rm" # git unstage - ( / - ) git config --global alias.unstage "reset HEAD --" # git backup - git config --global alias.backup \!'file=../`git describe`.tar && echo "Creating `readlink -f $file`" && tar cf $file .' # git config --global alias.st "status -sb" git config --global alias.ci commit git config --global alias.co checkout git config --global alias.br branch git config --global alias.bra "branch -a" git config --global alias.chp cherry-pick git config --global alias.pr "pull --rebase" git config --global alias.bl "blame -b -w" git config --global alias.cia "commit --amend" git config --global alias.lg "log --pretty=format:'%h was %an, %ar, message: %s' --graph" git config --global alias.who "shortlog -s --" # what else?
便利なエイリアスを共有してください!