本地修改

显示工作路径下已修改的文件:

$ git status

显示与上次提交版本文件的不同:

$ git diff

把当前所有修改添加到下次提交中:

$ git add 

把对某个文件的修改添加到下次提交中:

$ git add -p <file>

提交本地的所有修改:

$ git commit -a

提交之前已标记的变化:

$ git commit

附加消息提交:

$ git commit -m "message here"

提交,并将提交时间设置为之前的某个日期:

git commit --date="`date --date="n day ago"`" -am "Commit Message"

修改上次提交
请勿修改已发布的提交记录!

$ git commit --amend

把当前分支中未提交的修改移动到其他分支

git stash
git checkout branch2
git stash pop
文章导航