git clone git@… //初始化数据到本地
git status //检测本地修改过的文件
git branch -a //查看branch分支
git branch Jeremy //创建一个叫Jeremy的分支 (git branch -d dev 删除误建的dev分支)
git checkout Jeremy //从master切换到Jeremy这个分支上
git add * //添加修改过的文件
git commit -m “comment” //把文件修改提交到local的repository上
git push origin Jeremy //把local repository的修改同步到远程的repository
git status //查看是否还有未提交
git log //查看最近日志
git restore 文件名可以把已经修改但是没有commit的文件revert回来
理解working folder\local repository\remote repository三者之间的区别:
git add 和git rm只是发生在working folder阶段没有commit的情况下是不会影响local repository中的内容。
git commit之后才会影响local repository。
git push才会把local repository的变动同步到远程remote repository(远程网页可见)
git pull是把数据从remote repository同步到 local repository。
git checkout是把数据从local repository 同步至本地文件夹(woking folder)
命令 $ git diff 查看对比两次文件内容具体修改了什么。
命令 $ git diff HEAD – (“–”前后有空格),可以查看工作区和版本库