1.git回滚到上个版本
git reset --hard FETCH_HEAD
2.git忽略某些文件的提交
以前是用默认的.gitignore 然后再里面默认某些文件不提交。但是有个问题,.gitignore忽略不掉。因为这是一个全局的。可以改为这样子:
找到 隐藏的.git文件夹,在里面编辑.git/info/exclude文件(如果没有info则创建,默认是没有的),把要忽略的给编辑到exclude里面。
语法与.gitignore一致。两个文件区别在于,exclude只用于设置本地需要忽略的文件,而.gitignore是公共需要排除的。比如
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with ‘#‘ are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
zm-mc/target/
zm-mc/.gitignore
zm-mc/src/main/resources/rebel-remote.xml
zm-mc/src/main/resources/rebel.xml
.gitignore
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*