初识git
2015-11-01 15:12
369 查看
Last login: Sat Oct 31 14:15:31 on ttys000 QXdeMacBook-Pro:~ qx$ pwd /Users/qx QXdeMacBook-Pro:~ qx$ mkdir learngit QXdeMacBook-Pro:~ qx$ cd learngit/ QXdeMacBook-Pro:learngit qx$ pwd /Users/qx/learngit QXdeMacBook-Pro:learngit qx$ cd .. QXdeMacBook-Pro:~ qx$ ls Applications Documents Library Music Public 资料 Desktop Downloads Movies Pictures learngit QXdeMacBook-Pro:~ qx$ cd learngit/ QXdeMacBook-Pro:learngit qx$ git init Initialized empty Git repository in /Users/qx/learngit/.git/ QXdeMacBook-Pro:learngit qx$ ls QXdeMacBook-Pro:learngit qx$ ls -ah . .. .git QXdeMacBook-Pro:learngit qx$ vim readme.txt QXdeMacBook-Pro:learngit qx$ ls readme.txt QXdeMacBook-Pro:learngit qx$ git add readme.txt QXdeMacBook-Pro:learngit qx$ git commit -m "wrote a readme file!" -bash: !": event not found QXdeMacBook-Pro:learngit qx$ git commit -m "wrote a readme file" [master (root-commit) 1d5f01c] wrote a readme file Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file: git config --global --edit After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 readme.txt QXdeMacBook-Pro:learngit qx$ git config --global --edit QXdeMacBook-Pro:learngit qx$ git commit --amend --reset-author [master a535627] wrote a readme file Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 readme.txt QXdeMacBook-Pro:learngit qx$ git config --global --edit QXdeMacBook-Pro:learngit qx$ git commit --amend --reset-author [master 2a1c680] wrote a readme file Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 readme.txt QXdeMacBook-Pro:learngit qx$ git config --global --edit QXdeMacBook-Pro:learngit qx$ git commit --amend --reset-author [master 4e93c9a] wrote a readme file Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 readme.txt QXdeMacBook-Pro:learngit qx$ git commit --amend --reset-author [master 6f6b8c6] wrote a readme file Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 2 insertions(+) create mode 100644 readme.txt QXdeMacBook-Pro:learngit qx$ vim readme.txt QXdeMacBook-Pro:learngit qx$ git add readme.txt QXdeMacBook-Pro:learngit qx$ git commit -m "added a line" [master 9bdb747] added a line Committer: QX <qx@QXdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 1 insertion(+) QXdeMacBook-Pro:learngit qx$ git config --global user.name "Qx" QXdeMacBook-Pro:learngit qx$ git config --global user.email xqconverse@foxmail.com QXdeMacBook-Pro:learngit qx$ vim readme.txt QXdeMacBook-Pro:learngit qx$ git add readme.txt QXdeMacBook-Pro:learngit qx$ git commit -m "added another line" [master 18c7329] added another line 1 file changed, 1 insertion(+) QXdeMacBook-Pro:learngit qx$ vim readme.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") QXdeMacBook-Pro:learngit qx$ git diff readme.txt diff --git a/readme.txt b/readme.txt index eadac32..9ad9091 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -Git is a version control system. +Git is a distributed version control system. Git is free software. I added a line to this file! Added another line QXdeMacBook-Pro:learngit qx$ git add readme.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: readme.txt QXdeMacBook-Pro:learngit qx$ git commit -m "add distributed" [master a79c090] add distributed 1 file changed, 1 insertion(+), 1 deletion(-) QXdeMacBook-Pro:learngit qx$ git status On branch master nothing to commit, working directory clean QXdeMacBook-Pro:learngit qx$ ls readme.txt QXdeMacBook-Pro:learngit qx$ git log commit a79c0900b953cc66623c8d1912e22d658c778db0 Author: Qx <xqconverse@foxmail.com> Date: Sat Oct 31 14:45:57 2015 +0800 add distributed commit 18c73299971a52a9b6be7504fdcb914b21bd8702 Author: Qx <xqconverse@foxmail.com> Date: Sat Oct 31 14:39:49 2015 +0800 added another line commit 9bdb747660a7308163d703ca062e126b5ed3fc8c Author: QX <qx@QXdeMacBook-Pro.local> Date: Sat Oct 31 14:37:18 2015 +0800 added a line commit 6f6b8c64b52325da7596b0492e7cad8e7d7ad6c7 Author: QX <qx@QXdeMacBook-Pro.local> Date: Sat Oct 31 14:35:06 2015 +0800 wrote a readme file QXdeMacBook-Pro:learngit qx$ git log --pretty=oneline a79c0900b953cc66623c8d1912e22d658c778db0 add distributed 18c73299971a52a9b6be7504fdcb914b21bd8702 added another line 9bdb747660a7308163d703ca062e126b5ed3fc8c added a line 6f6b8c64b52325da7596b0492e7cad8e7d7ad6c7 wrote a readme file QXdeMacBook-Pro:learngit qx$ git reset --hard HEAD^ HEAD is now at 18c7329 added another line QXdeMacBook-Pro:learngit qx$ cat readme.txt Git is a version control system. Git is free software. I added a line to this file! Added another line QXdeMacBook-Pro:learngit qx$ git log commit 18c73299971a52a9b6be7504fdcb914b21bd8702 Author: Qx <xqconverse@foxmail.com> Date: Sat Oct 31 14:39:49 2015 +0800 added another line commit 9bdb747660a7308163d703ca062e126b5ed3fc8c Author: QX <qx@QXdeMacBook-Pro.local> Date: Sat Oct 31 14:37:18 2015 +0800 added a line commit 6f6b8c64b52325da7596b0492e7cad8e7d7ad6c7 Author: QX <qx@QXdeMacBook-Pro.local> Date: Sat Oct 31 14:35:06 2015 +0800 wrote a readme file QXdeMacBook-Pro:learngit qx$ git reset --hard a79c090 HEAD is now at a79c090 add distributed QXdeMacBook-Pro:learngit qx$ cat readme.txt Git is a distributed version control system. Git is free software. I added a line to this file! Added another line QXdeMacBook-Pro:learngit qx$ git reflog a79c090 HEAD@{0}: reset: moving to a79c090 18c7329 HEAD@{1}: reset: moving to HEAD^ a79c090 HEAD@{2}: commit: add distributed 18c7329 HEAD@{3}: commit: added another line 9bdb747 HEAD@{4}: commit: added a line 6f6b8c6 HEAD@{5}: commit (amend): wrote a readme file 4e93c9a HEAD@{6}: commit (amend): wrote a readme file 2a1c680 HEAD@{7}: commit (amend): wrote a readme file a535627 HEAD@{8}: commit (amend): wrote a readme file 1d5f01c HEAD@{9}: commit (initial): wrote a readme file QXdeMacBook-Pro:learngit qx$ git reset --hard 18c7329 HEAD is now at 18c7329 added another line QXdeMacBook-Pro:learngit qx$ cat readme.txt Git is a version control system. Git is free software. I added a line to this file! Added another line QXdeMacBook-Pro:learngit qx$ git reflog 18c7329 HEAD@{0}: reset: moving to 18c7329 a79c090 HEAD@{1}: reset: moving to a79c090 18c7329 HEAD@{2}: reset: moving to HEAD^ a79c090 HEAD@{3}: commit: add distributed 18c7329 HEAD@{4}: commit: added another line 9bdb747 HEAD@{5}: commit: added a line 6f6b8c6 HEAD@{6}: commit (amend): wrote a readme file 4e93c9a HEAD@{7}: commit (amend): wrote a readme file 2a1c680 HEAD@{8}: commit (amend): wrote a readme file a535627 HEAD@{9}: commit (amend): wrote a readme file 1d5f01c HEAD@{10}: commit (initial): wrote a readme file QXdeMacBook-Pro:learngit qx$ git reset --hard a79 fatal: ambiguous argument 'a79': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' QXdeMacBook-Pro:learngit qx$ git reset --hard a79c090 HEAD is now at a79c090 add distributed QXdeMacBook-Pro:learngit qx$ cat readme.txt Git is a distributed version control system. Git is free software. I added a line to this file! Added another line QXdeMacBook-Pro:learngit qx$ vim readme.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt Untracked files: (use "git add <file>..." to include in what will be committed) .DS_Store license.txt no changes added to commit (use "git add" and/or "git commit -a") QXdeMacBook-Pro:learngit qx$ git add readme.txt QXdeMacBook-Pro:learngit qx$ git add license.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: license.txt modified: readme.txt Untracked files: (use "git add <file>..." to include in what will be committed) .DS_Store QXdeMacBook-Pro:learngit qx$ git commit -m "understand how stage works" [master 575d876] understand how stage works 2 files changed, 2 insertions(+) create mode 100644 license.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) .DS_Store nothing added to commit but untracked files present (use "git add" to track) QXdeMacBook-Pro:learngit qx$ cat .DS_Store Bume.txt readme.txtIlocblobF(?????? readmeRog,.txtIlocblob?/?? @? @ @ @ E?DSDB @ @ @QXdeMacBook-Pro:learngit qx$ :wq -bash: :wq: command not found QXdeMacBook-Pro:learngit qx$ ls license.txt readme.txt QXdeMacBook-Pro:learngit qx$ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) .DS_Store nothing added to commit but untracked files present (use "git add" to track) QXdeMacBook-Pro:learngit qx$ ls -ah . .. .DS_Store .git license.txt readme.txt QXdeMacBook-Pro:learngit qx$
相关文章推荐
- it book 资源
- 正则表达式 零宽断言 负向零宽断言 平衡组/递归匹配
- iOS 灰度发布的具体操作
- Android SDK在线更新镜像服务器
- linux 常用基础命令 mkdir 详细介绍
- 将字符串中符合规则的子串取出
- [NOIP2013]转圈游戏
- Datawindow.net 子数据窗口出错
- 【原创】深入理解c++的右值引用
- noip2014 寻找道路 (两次逆向宽搜)
- noip2014 无线网路发射器选址 (模拟)
- HDU 2579--Dating with girls(2)【BFS && 三维判重】
- 导入数据时报错: MySQL server has gone away
- noip2014 联合权值 (树形结构)
- Android触摸屏事件派发机制详解与源码分析三(Activity篇)
- noip2014 生活大爆炸版 石头剪刀布 (模拟)
- (抽象)类和接口细节分析
- 利用 thermald和Intel P-state防止笔记本过热
- AngularJS教程
- 本地建立svn管理项目