[b]添加本地存储:[/b]
git init : init repository /.git/
git status :查看存储状态
git add Hello.java : put file into staging area
git add '*.txt' : add
git reset octofamily/octodog.txt: put file staged into unstage
git commit -m 'Add cute octocat story' :
store staged file in the local respository
with describing message
为~/.gitconfig 文件添加 用户默认用户名和邮件的配置文件
git config --global user.email “abc@ab.com”
git config --global user.name "abc"
git log :查看每次commit 的信息
[b]添加remote repository[/b]
git remote add origin git@github.com:hlxinyan/try_git.git
git push -u origin master:
origin:remote repo name
master:the default local branch name
-u :tells Git to remember the parameters,
so that next time we can simply run git push
git push corp HEAD:refs/for/master
git pull origin master:check for changes on our GitHub repository
and pull down any new changes
git diff HEAD:
HEAD:是一个指针,记录着 用户本人做的不同提交的位置
git diff --staged:比较处于staged 文件
[/size]
git checkout -- octocat.txt :从remote中获取otcocat 文件覆盖本地
[b]创建branch[/b]
git checkout -b new_branch or
git branch new_branch
git checkout new_branch
[b]切换分支[/b]
git checkout master
[b]分支合并[/b]
git merge clean_up
[b]删除分支 [/b]
git branch -d <branch name>
[b]删除文件或者文件夹[/b]
git rm '*.txt'
git rm -r folder_of_cats
[b]提交branch 变化[/b]
git commit -m 'Commit delete all txt files'
git init : init repository /.git/
git status :查看存储状态
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
Success
!git add Hello.java : put file into staging area
git add '*.txt' : add
git reset octofamily/octodog.txt: put file staged into unstage
git commit -m 'Add cute octocat story' :
store staged file in the local respository
with describing message
为~/.gitconfig 文件添加 用户默认用户名和邮件的配置文件
git config --global user.email “abc@ab.com”
git config --global user.name "abc"
[master (root-commit) d0fe168] Add cute octocat story
1 file changed, 1 insertion(+)
create mode 100644 octocat.txt
Success!
git log :查看每次commit 的信息
[b]添加remote repository[/b]
git remote add origin git@github.com:hlxinyan/try_git.git
git push -u origin master:
origin:remote repo name
master:the default local branch name
-u :tells Git to remember the parameters,
so that next time we can simply run git push
git push corp HEAD:refs/for/master
git pull origin master:check for changes on our GitHub repository
and pull down any new changes
git diff HEAD:
HEAD:是一个指针,记录着 用户本人做的不同提交的位置
git diff --staged:比较处于staged 文件
diff --git a/octocat.txt b/octocat.txt
index 7d8d808..e725ef6 100644
--- a/octocat.txt
+++ b/octocat.txt
@@ -1 +1 @@
-A Tale of Two Octocats
+A Tale of Two Octocats and an Octodog
Success!
[/size]
git checkout -- octocat.txt :从remote中获取otcocat 文件覆盖本地
[b]创建branch[/b]
git checkout -b new_branch or
git branch new_branch
git checkout new_branch
[b]切换分支[/b]
git checkout master
[b]分支合并[/b]
git merge clean_up
[b]删除分支 [/b]
git branch -d <branch name>
[b]删除文件或者文件夹[/b]
git rm '*.txt'
git rm -r folder_of_cats
[b]提交branch 变化[/b]
git commit -m 'Commit delete all txt files'