git 相关问题 总汇

来源:互联网 发布:notepad mac 破解版 编辑:程序博客网 时间:2024/05/26 15:59

最近在使用Android的repo和git的过程中遇到了很多莫名奇妙的问题,现在记录一下,便于自己以后的查用。

1.repo sync中遇到error:......checkout ....接一串hashnumber

解决方法:进到它说提示的目录中,用git status显示文件,将修改过的文件删除掉,再重新repo sync

2.repo sync中遇到:contains uncommitted changes

解决方法:进到它说提示的目录中,使用git reset --hard命令

3. 怎么对repo下的所有project执行git命令

解决方法:repo forall -c git checkout -b    //该条命令会对repo下的project执行切换branch的命令

4. 怎么切换到你想要的branch

解决方法:git checkout branchName,比如 git checkout testBranch



在使用repo sync同步代码时候出现

error: .repo/manifests/: contains uncommitted changes

出现这个问题的原因是本地代码发生变化,但未commit

 

试着通过 git reset --hard来恢复所有变化的文件之后,依然存在上述问题,

最后通过cd .repo/manifests 切换到.repo/manifests目录下执行git stash命令,并

通过git clean -f -d命令删除变化记录目录,然后使用repo sync就可以通过了。

原创粉丝点击