标签:
When you create a branch off the master
branch, you’re making a copy, or snapshot, of master
as it was at that point in time. If someone else made
changes to the master
branch while you were working on your branch, you could pull in those updates.
On GitHub, saved changes are called commits. Each commit has an associated commit message, which is a description explaining why a particular change
was made.
As soon as you make a commit, you can open a pull request and start a discussion, even before the code is finished.
Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you’re proposing your changes and requesting that someone review
and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches. The changes,
additions, and subtractions are shown in green and red.
linux中的常用指令:
git clone 文件地址
git status
git pull
git add
git commit
git push
git log 显示提交日志
git reflog 显示一份记录最近几个月你的 head 和分支引用的日志,每次你的分支顶端因为某些原因被修改时,git 就会为你将信息保存在这个临时
历史记录里面。你也可以使用这份数据来指明更早的分支。如果你想查看仓库中head 在五次前的值,你可以使用引用日志的输出中的@{n}
引用
$ git show head@{5}
你也可以使用这个语法来查看一定时间前分支指向哪里。例如,想看你的 master
分支昨天在哪,你可以输入
$ git show master@{yesterday}
它就会显示昨天分支的顶端在哪。这项技术只对还在你引用日志里的数据有用,所以不能用来查看比几个月前还早的提交。
想要看类似于 git log
输出格式的引用日志信息,你可以运行 git log -g
:
$ git log -g master
方法: (此方法push后会将commit_id之前的commit版本删除,github页面上不会再显示已删除的commit,git log中也不显,只有git reflog中有)
git reset --hard <commit_id>
git push origin HEAD --force
注释:
HEAD 最近一个提交
HEAD^ 上一次
<commit_id> 每次commit的SHA1值. 可以用git log 看到,也可以在页面上commit标签页里找到
其他:
根据–soft –mixed –hard,会对working tree和index和HEAD进行重置:
git reset –mixed:此为默认方式,不带任何参数的git reset,即时这种方式,它回退到某个版本,只保留源码,回退commit和index信息
git reset –soft:回退到某个版本,只回退了commit的信息,不会恢复到index file一级。如果还要提交,直接commit即可
git reset –hard:彻底回退到某个版本,本地的源码也会变为上一个版本的内容
标签:
原文地址:http://www.cnblogs.com/yaohunzhanyue/p/5719780.html