这里有我的脚丫印😄

程序媛


  • 首页

  • 归档

git

发表于 2016-07-19 |

学习链接:
Git Cheat Sheet 中文版
http://mp.weixin.qq.com/s?__biz=MzIzNjQyMzc0Mw==&mid=2247483708&idx=1&sn=9296671981ce336bf67e3f13d9713880#rd

https://backlogtool.com/git-guide/tw/stepup/stepup2_1.html

mkdir tutorial 建立文件夹 tutorial
cd tutorial 进入tutorial文件夹
git init Initialized empty Git repository in /Users/eguchi/Desktop/tutorial/.git/
把该目录变成一个被git掌握的目录
git add README 把某档案加入git的控制
git add . 把当前目录加入git的控制
git add myfile.txt
註冊檔案或目錄到索引
git commit -m “first commit”
把已经加入控制的档案,正式记录到这次变更。
git status
顯示修改檔案清單
加上 -s 參數,僅會顯示已修改的檔案名稱。
如果在 -s 後再加上 -b 參數,則會顯示分支的名稱。
git remote add origin git://github.com/xxx.git
把远端的原始来源设为github端点
git push origin master
本地的主分支叫master
远端的端点叫origin
git push -u origin master
以后预设都是推到origin master,所以以后可以直接git push

git pull
拉下远端变更
git diff
查看修改檔案的差異
僅使用 “diff” 命令時,會顯示工作目錄和索引的差異。
加上 –cached 參數,會顯示索引與 HEAD 的差異。
如果指定特定的HEAD 或提交,則可以顯示工作目錄和指定HEAD/提交之間的差異。
git log
僅使用“log” 將顯示分支的提交列表。
如果要查看特定檔案的提交記錄,請指定檔案名稱。
git show
請使用show命令,show命令的參數可以指定log命令參閱的提交與HEAD。
git mv
修改/移動一個檔案/目錄的名稱
git rm
刪除檔案
git clean
加上 -n 參數,可以查看將被刪除的檔案。
若添加 -f 參數則會立即刪除檔案。

在預設情況下 .gitignore 檔案中所列之檔案/目錄並不在刪除範圍內。不過如果加上-x 參數, .gitignore 檔案中             的檔案/目錄也會從工作目錄中刪除。

git checkout –
還原在工作目錄已更改的檔案
比如 git checkout – app/views/account/questions/show.html.erb
这是取消本地app/views/account/questions/show.html.erb的修改,还原到git当前的状态
git checkout – *
这是取消本地所有文件的更改
git reset HEAD –
刪除已註冊到索引的檔案
git add -u
只註冊已提交過的檔案到索引

git branch issue1 建立 issue1 分支
git branch 显示分支列表
git checkout issue1 切换到issue1分支
git checkout -b issue1 同时建立issue1分支并切换到issue1分支

合并并提交到master
git checkout master 切换到master
git merge issue1 fast-forward快转合并

git merge issue2 如果issue1和issue2冲突了,修改之后再进行提交
non fast-forward合并

git reset –hard HEAD~ 取消刚刚的合并
git checkout issue3 切换到issue3
git rebase master
发生冲突,修改后
git add myfile.txt
git rebase –continue 继续rebase操作 rebase –abort 中途要停止 rebase 的操作
git checkout master
git merge issue3

git branch -d issue1 删除issue1

pull = fetch + merge

push

git tag apple 建立标签apple
git tag 显示tag标签列表
git log –decorate 显示包含标签资料的历史记录
git tag -am “連猴子都能懂的Git” banana 建立banana标签
git tag -n 显示表情列表和注解
git tag -d 删除标签

修改最近的提交
欲修改同一個分支最近的提交內容或註解,您可以在提交命令時加上 –amend 參數執行。
主要使用的場合
增加最近提交時漏掉的檔案
修改最近的提交的內容或註解

git reset –hard ORIG_HEAD
在reset之前的提交可以參照ORIG_HEAD。 Reset錯誤的時候,在ORIG_HEAD上reset 就可以還原到reset前的狀態。

git rebase -i HEAD~~ 合并过去的提交

删除.git
rm -rf .git

Hello World

发表于 2016-07-14 |

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

1…89

陈云莉 m18301662790@gmail.com

记录一些技术点,留下一些生活感悟

82 日志
25 标签
© 2017 陈云莉 m18301662790@gmail.com
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.3