git删除所有历史提交记录,只留下最新的干净代码 1.Checkout git checkout --orphan latest_branch 2. Add all the files git add -A 3. Commit the changes git commit -am "commit message" 4. Delete the branch git branch -D master 5.Rename the current branch to master git bra
查看当前的工作状态:git status On branch master:现在位于master分支里面nothing to commit, working tree clean:没有需要提交的文件,当前目录是干净的,即,在上一次提交过后,到目前为止,此目录下的内容没有被改变过 再新建一个文件,不加入暂存区,查看状态 提示有未跟踪文件,即有新添加,但并没有加到暂存区或者提交的文件 提交到暂存区后,再查看状态 git reset HEAD <file> : 恢复暂存区域,因为刚刚提交了一个New