Git操作备忘
来源:互联网 发布:阿里云升级配置后 编辑:程序博客网 时间:2024/05/22 00:55
修改file1.txt后,
$git status
显示file1有改动,如果不想要刚才的改动。
$ git checkout -- file1.txt
file1恢复到改动之前。
如果想保留刚才的改动,再次 git add file1.txt, 然后 git commit -m "..........................."
$ git diff readme.txt
修改内容后,查看改动内容$ git log
查看每次提交$ git log --pretty=oneline3628164fb26d48395383f8f31179f24e0882e1e0 append GPLea34578d5496d7dd233c827ed32a8cd576c5ee85 add distributedcb926e7ea50ad11b8f9e909c05226233bf755030 wrote a readme file
$ git reset --hard HEAD^HEAD is now at ea34578 add distributed
上一个版本就是HEAD^,上上一个版本就是HEAD^^,当然往上100个版本写100个^比较容易数不过来,所以写成HEAD~100。
******http://www.git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History******
$ git log
$ git log -p -2
$ git log -U1 --word-diff
$ git log -U1 -p -2 --word-diff
$ git log --stat
$ git log --pretty=oneline
$ git log --pretty=format:"%h - %an, %ar : %s"
Option Description of Output
%H
Commit hash%h
Abbreviated commit hash%T
Tree hash%t
Abbreviated tree hash%P
Parent hashes%p
Abbreviated parent hashes%an
Author name%ae
Author e-mail%ad
Author date (format respects the --date= option)%ar
Author date, relative%cn
Committer name%ce
Committer email%cd
Committer date%cr
Committer date, relative%s
Subject$ git log --pretty=format:"%h %s" --graphOption Description
-p
Show the patch introduced with each commit.--word-diff
Show the patch in a word diff format.--stat
Show statistics for files modified in each commit.--shortstat
Display only the changed/insertions/deletions line from the --stat command.--name-only
Show the list of files modified after the commit information.--name-status
Show the list of files affected with added/modified/deleted information as well.--abbrev-commit
Show only the first few characters of the SHA-1 checksum instead of all 40.--relative-date
Display the date in a relative format (for example, “2 weeks ago”) instead of using the full date format.--graph
Display an ASCII graph of the branch and merge history beside the log output.--pretty
Show commits in an alternate format. Options include oneline, short, full, fuller, and format (where you specify your own format).--oneline
A convenience option short for --pretty=oneline --abbrev-commit
.*************http://www.git-scm.com/book/en/Git-Basics-Undoing-Things*****************$ git commit -m 'initial commit'
$ git add forgotten_file
$ git commit --amend
****************http://www.git-scm.com/book/en/Git-Basics-Working-with-Remotes********************
$ git remote
$ git remote -v
$ git remote add pb git://github.com/paulboone/ticgit.git
$ git fetch [remote-name]
$ git push origin master
$ git remote rename pb paul
$ git remote rm paul
****************http://www.git-scm.com/book/en/Git-Basics-Tagging************************
$ git tag
$ git tag -l 'v1.4.2.*'
$ git tag -a v1.4 -m 'my version 1.4'
*********************http://www.git-scm.com/book/en/Git-Branching-What-a-Branch-Is*********************
Staging the files checksums each one (the SHA-1 hash we mentioned in Chapter 1), stores that version of the file in the Git repository (Git refers to them as blobs), and adds that checksum to the staging area:
$ git branch testing
$ git checkout testing
$ git checkout -b iss53
Switched to a new branch 'iss53'
- Git操作备忘
- 备忘,git常用操作
- 常用git操作备忘
- git操作命令备忘
- GIT常用操作备忘
- git及svn操作备忘
- git基本命令操作备忘
- git备忘
- git 备忘
- Git 备忘
- git备忘
- Git备忘
- git 备忘
- 【Git学习】Git命令备忘
- Git 使用备忘
- IOS Git资源 备忘
- Git常用命令备忘
- Git常用命令备忘
- Pyhton字典用法
- Error was Port already in use: 40001
- 开始学习golang
- Linux makefile改进
- 嵌入式启动之五:基于S5PV210的UBOOT概述
- Git操作备忘
- 百度影棒usb接口为什么不支持摄像头
- 用JavaScript来包装文本元素节点
- 回溯法实现八皇后问题
- 好用的shell——zsh
- ACM 519. [NOIP2010] 乌龟棋(dp)
- 值得一生去看的演讲
- hihocoder-第九周-状态压缩二
- 版本控制、Git和Domino