Github轻松上手4-常用的git命令

转自:http://blog.sina.com.cn/s/blog_4b55f6860100zzih.html

附上一些git的常见命令:

 

•    git remote add origin [email protected]:myaccount/myproject.git   

•    git push -u origin master

•    gitinit--------建立repository

•    git 命令 --help-----------查看帮助命令

•    touch filename

•    git status------查看状态

•    git add filename--------加入文件到临时的东东

•    git commit -m "add the file filename" -----commit到repository中

•    git log------查看日志

•    echo "ddd" > filename ------修改filename(先清空)

•    git add filename 

•    git commit -m "filename changed"

•    git diff 版本一 版本二--------比较不同

•    git reset 版本号--------返回到版本号

•    git revert 版本号--------撤销到版本号

•    git checkout filename------撤销当下没有git add的动作

•    git branch-------参看分支信息

•    git branch develop-----建立分支

•    git checkout develop-----切换分支

git merge develop------合并分支(将develop  merge到master上,develop不变)

 

没有提到的部分,请参考官方说明

http://help.github.com/mac-set-up-git/

你可能感兴趣的:(github)