Linux迷,Python粉
人生苦短,我用Python 新博客https://blog.pythonwood.com 问题小站https://qa.1r1g.com 智问智答https://qa.1r1g.cn

Git书籍有《版本控制之道git》,但是很一般。强烈推荐《Git Pro》中文版! 

很多开源软件的教程也是免费开源的在线阅读的。

《Git Pro》中文版在线阅读http://iissnan.com/progit/     (同前需FQ浏览)http://git-scm.com/book/zh

Pro Git书籍源码http://www.worldhello.net/gotgithub/

progit

git是一个软件工具,在实践中才能熟悉之,所以学习是长期坚持运用的过程。

笔记:

 

开始Git:

git config --global --user.name "pythonwood"
git config --global --user.email "582223837@qq.com
#git config --global --list #list all mk HelloWorld cd HelloWorld git init #make .git git add . git status #which is changed git commit -m "add commit: add something" \ -m "This allows for a more semantic document." #git log -1 --pretty=oneline #显示最后一次

分支:
merge后就可以删除分支,git branch -d # git branch --no-merge 显示未合并分支
rebase有趣示例:
多分支时rebase: git rebase --onto master branch20131029 branch2 # 位于branch20131029上时,跳过branch2的父分支branch20131029,将branch2的特有变化在master上演化一次。
跟踪远程分支:
git checkout -b hotfix origin/hotfix # --track
删除远程分支:
git checkout origin :hotfix

rebase重难点:如果把衍合当成一种在推送之前清理提交历史的手段,而且仅仅衍合那些尚未公开的提交对象,就没问题。如果衍合那些已经公开的提交对象,并且已经有人基于这些提交对象开展了后续开发工作的话,就会出现叫人沮丧的麻烦。

知识点:
git add 与 git reset相对
git commit 与 git checkout相对
git merge 与 git rebase相似
git branch --merge 与 git branch --merge 相对 (merged ok too)
分支合并时rebase后再merge会快进,即前进式merge。
git checkout --track = git checkout -b


git check -b <name> = git branch <name> + git checkout <name>
git pull = git fetch + git merge
git commit -a -m = git add + git commit -m

常用git命令:
git commit --amend
git status
git diff

git 标签:
1、tag <name> [SHA]
2、tag -a <name> [SHA]
3、tag -s <name> (高级)

git push origin --tags (必须显式使用参数)




**与服务器交互:
git config --global push.default simple # 使用默认模式,不用每次push都提示
git clone git@github.com:/pythonwood/HelloWorld.git # 自动分支成远程引用origin/master和本地master。如果有写权限,git remote -v 可见到push权限。
#git remote 引用一个远程仓库(地址)别名:origin


必须先pull再push,方式有git,https,ssl等等**
posted on 2013-10-17 12:50  月冷风和霜  阅读(1193)  评论(0编辑  收藏  举报

智问智答 https://qa.1r1g.cn 问题小站 https://qa.1r1g.com