Skip to content

git & repo cmd

David edited this page Jan 14, 2015 · 8 revisions

repo

  • ./repo init -u ssh://mypc@192.168.7.32:29418/OTT/M3/manifests -b master
  • ./repo sync
  • ./repo forall -c git stash
  • ./repo forall -c git stash clear

git

git删除远程分支后,本地同步问题

git branch -r -d orgin/xxx
git push origin :xxx
想在的项目组里同步一下,结果发现git pull和git fetch都不能删除remite/origin/xxx。(具体表现是branch -a还显示有远程xxx分支)。后来找了一下资源,再git fetch --help发现有一个参数'-p'可以解决这个问题。
最后:git fetch -p。搞定。

彻底删除某commit,不保留历史记录

git-clean - Remove untracked files from the working tree

修改前一次提交的方法

git add .
git commit –amend

or

git reset HEAD^
#重新修改
git add .
git commit -m “MSG”

如果email不对,会无法提交到Gerrit,所以这个命令也可能用到。

git commit –amend –author=<user-email>

ref

Clone this wiki locally