git琐事二三

本来想写git趣事二三的……想了想好像没什么这么多有趣的事情,那还是用“琐事”一词算了。接下来的故事大多取材于过去半年的项目合作。

琐事一:一种非常奢华的rebase姿势:

git revert HEAD
git commit -am "Reverted a commit which can cause conflict."
git merge another_branch
git revert HEAD^
git commit -am "Rebase completed."

琐事二:

$ git push origin master
Access denied.
fatal: Could not read from remote repository.
$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa
passphrase:
$ git push origin master
Everything up-to-date.

琐事三:git其实自带节点描述功能,配合gradle可以做apk包的版本,核心命令是:

git describe --tags --dirty

琐事四:

git add .

未完待续