使用GIT遇到的问题及解决办法
记录使用GIT时遇到的问题及解决办法:
1、error: failed to push some refs to 'http://xxx.git'
- 问题
执行git push origin mytask
推送代码时报错:
error: failed to push some refs to 'http://xxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
- 解决办法
删除远端自己的分支,重新push即可:
git push origin --delete mytask
2、文件重命名后仍存在
- 问题
由于Java类(AaabbbCcc.java
)命名不规范,所以后来重新命名为驼峰格式(AaaBbbCcc.java
),但在系统构建中仍然提示:
AaabbbCcc.java error: class AaaBbbCcc is public, should be declared in a file named AaaBbbCcc.java
- 解决办法
运行git rm
命令删除旧的文件后重新提交推送:
git rm AaabbbCcc.java