git实践

1 篇文章 0 订阅
写在前面:

强烈推荐一本学习git的书籍《看日记学git》,请一定要看:如果你使用linux开发,且对命令不是很熟练。

============about git==================
1.git代码提交
  git status
  git diff
  git add .
  git commit -m "your comment"
  git fetch;git rebase
  git push origin HEAD:refs/for/master

参考:

http://blog.csdn.net/crylearner/article/details/7685158



2.git working tree rollback
  • git checkout file1 (回滚单个文件)
  • git checkout file1 file2 ... fileN (一次回滚多个文件,中间用空格隔开即可)
  • git checkout . (直接回滚当前目录一下的所有working tree内的修改,会递归扫描当前目录下的所有子目录
3.branch操作
创建tempFiger分支:
    git branch tempFiger
删除tempFiger分支:
    git branch -d tempFiger
切换到master分支:
    git checkout  master
显示所有分支:
    git branch

4.git clone
ex1.   git clone ssh://pe----ng@19-----84:29418/tz
ex2.   git clone http://p------ng@1------4:29418/tz
详见:《看日记学 git 》之十五

5.query commit history
    git show changeId      ex:  git show 5b888402aadd3cd41b3fe8c84a8658da07893b20
    git grep "grep content"

6.local git 组成 及 对应提交环节
current working directory      working tree     1
index file                                  index file          2
git local respository                commit            3
    git diff                       12
    git diff --cached        23
    git diff HEAD           13
可以同时有n个local git存在

7.git提交到github练习
git clone https://github.com/codefiger/spring-mvc-mini.git
cd spring-mvc-mini/
(开发...编译...测试...)
git status
git add .
git commit -m "just add a system"
git fetch;git rebase
git push -u origin master
git log


others:
git log -p
git commit amend
man git -****      
git branch          查看已经存在的分支
git merge
git reset 撤销修改
git checkout  撤销修改  or  switch to another branch
git pull  == git fetch;git merge
git pull  --rebase  == git fetch;git merge
git merge & git rebase 区别:merge会生成一个新得合并节点,而rebase不会
============================================


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值