GIt使用总结

1、 拉取代码

git clone ssh://[email protected]:22222/goods-record-system.git

2、创建本地分支

git branch feature_goods-record-system_0314_wjj
IDEA上右下方NEW BRANCH直接创建

3、查看本地分支

git branch


4、查看远程分支
  

git branch -a


5、切换分支
    

git branch feature_goods-record-system_0314_wjj


6、提交到暂存区

git commit 
IDEA项目名上右键->Git->Commit Dictionary...


7、提交到远程分支

git push origin test:test
git push origin test 不写远程分支名称,默认提交到与本地分支同名的远程分支
IDEA项目名上右键->Git->Resposity->push


8、拉取远程分支(不习惯用)

git pull origin test:test
git pull origin test 不写远程分支名称,默认提交到与本地分支同名的远程分支
IDEA项目名上右键->Git->Resposity->pull


9、合并别人的分支

git branch feature_goods-record-system_0314_wjj   切换到自己的本地分支
git merge test     合并分支
手动解决冲突


10、手动解决冲突方法
    合并分支后,IDEA下方有resolve提醒,点击,手动解决每个冲突文件
    
11、查看当前文件(工作目录)状态

git status


12、文件执行了git add操作,但想撤销对其的修改

git reset HEAD fileName     取消暂存
git checkout fileName     撤销修改


13、已在本地进行了多次git commit操作,现在想撤销到其中某次Commit

git reset --hard HEAD^  回滚到上一次commit版本


14、查看文件历史版本

git log     不写文件名表示整个项目


15、 回滚到指定commitID

git checkout   


  

你可能感兴趣的:(其他)