git

来源:互联网 发布:电视柜淘宝 编辑:程序博客网 时间:2024/06/05 16:43

参考https://try.github.io/levels/1/challenges/1

git initgit statusgit add '*.txt":所有的包括子文件夹中的txtgit commit -m git pushgit loggit remote add origin https://github.com/try-git/try_git.gitgit pull -u origin master:-u tells Git to remember the parameters.git pull origin mastergit diff HEAD:the diff of our most recent commit, which we can refer to using the HEAD pointer
---staged differences of stage filesgit add octofamily/octodog.txtgit diff --staged:another great use for diffgit reset octofamily/octodog.txt:unstaging octodog.txtgit checkout -- octocat.txt:Files can be changed back to how they were at the last commit---branchgit checkout -b clean_upgit rm '*.txt'git commit -m "Remove all the cats"git checkout mastergit merge clean_upgit branch -d clean_up---git checkout -b new_branchgit pull origin master --rebasegit push origin new_branch

git pull = git fetch +git merge
git pull –rebase = git fetch +git rebase
http://stackoverflow.com/questions/18930527/difference-between-git-pull-and-git-pull-rebase

一个推荐的git流程:http://nvie.com/posts/a-successful-git-branching-model/ ,长期只有master和develop分支,新建一个分支后,merge到master

回滚操作

git log --graph 查看历史版本号git reset --hard hashvaluegit reflog git merge --no-ff hotfix-1.2.1git branch -d hotfix-1.2.1master 分支每个节点都会用版本号打 tag。git tag -a 1.2.1
原创粉丝点击