git笔记

git笔记

如果从来没有git的使用经验,请参照廖雪峰的教程

在这里我仅仅将常用的几个命令记录下来,形成一个完整的流程,实现较好的复习和巩固。

git init
echo "First always goes as a readme file" > readme.md
git add readme.md
git commit -m "create a readme file"
git remote add origin git@github.com:myprojectgithubpage/learngit.git
git p u s h -u origin master
git p u s h origin master

分支管理:

git checkout -b dev
git branch
git add readme.txt
git commit -m "branch test"
git checkout master
git merge dev
git branch -d dev

常用命令还有:

gitstatus
git diff readme.md
git log --pretty=oneline --abbrev-commit
gitr e s e t --hard HEAD^
gitr e s e t --hard 3628164
git reflog    #view history
git checkout -- readme.md    #abandon change in workbench
git reset HEAD readme.txt    #unstage file change in temp
git rm test.txt
git clone
git merge --no-ff -m "merge with no-ff" dev
git stash    #protect spot w h e n fix bug
git stash list
git stash pop=git stash apply+git stash d r o p
git stash apply stash@{0}
git remote -v

git branch --set-upstream dev origin/dev	#multiwork
git pull
git push origin branch-name	

git tag v1.0
git tag v0.9 6224937
git show v0.9
git tag -a v0.1 -m "version 0.1 released" 3628164
git tag -s v0.2 -m "signed version 0.2 released" fec145a
git tag -d v0.1
git push origin v1.0
git push origin --tags
git push origin :refs/tags/v0.9

.gitignore文件中表示的是不提交的本地文件
所有配置文件可以直接在线浏览:https://github.com/github/gitignore
创建一个git服务器。详情查看教程。

2017年04月28日@Cheng
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值