您的位置:首页 > 其它

<> reading note 2011-4-6 21:57:08

2011-04-07 00:52 253 查看
git config --global user.name ""
git config --global user.email "yzchen@smit.comc.cn"
git config --list
git config user.name
git help command
git init
git add
git commit -m "comment"
git clone ...git yourgitname
git status // check current branch
git reset HEAD <file>
.gitignore // ignore some file and never track them
# 此为注释 – 将被 Git 忽略
*.a # 忽略所有 .a 结尾的文件
!lib.a # 但 lib.a 除外
/TODO # 仅仅忽略项目根目录下的 TODO 文件,不包括 subdir/TODO
build/ # 忽略 build/ 目录下的所有文件
doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt

git diff
git diff --cached
git diff --staged  //can diff two commit version??
git commit -a -m
git rm [-f] fileName // delete
git rm --cached fileName //不跟踪的
git mv fileFrom fileTo
git log
git log --p -2
git log --stat
$ git log --pretty=format:"%h %s" --graph
-p 按补丁格式显示每个更新之间的差异。
--stat 显示每次更新的文件修改统计信息。
--shortstat 只显示 --stat 中最后的行数修改添加移除统计。
--name-only 仅在提交信息后显示已修改的文件清单。
--name-status 显示新增、修改、删除的文件清单。
--abbrev-commit 仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。
--relative-date 使用较短的相对时间显示(比如,“2 weeks ago”)。
--graph 显示 ASCII 图形表示的分支合并历史。
--pretty 使用其他格式显示历史提交信息。可用的选项包括 oneline,short,full,fuller 和 format(后跟指
定格式)。

git commit --amend
git checkout -- fileName //撤销操作

git remote
git remote -v
orgin 表示远程创库的地址

git fetch 到得东西放到哪里,为什么不会覆盖呢???答:他们属于不同的分支 origin/master 和 master 是不同的

git push orgin master

// 标签,发布版本用
git tag -a v1.7 -m "comment"
git show v1.7

------------------------------------------------------------------------branch
git checkout "branchName"

git branch branchName
git checkout branchName

git checkout master
git merge branchName  //合并到主分支

git branch -d branchName // delete branch 用-D表示强制删除未合并的分支

git mergetool toolname

修改冲突后要 add 看看 status 在 commit

git branch [-v] [--merged] [--no-merged]

git push origin mybranch   //共享你的branch
== git push origin mybranch|mybranch
git push origin |mybranch  // 删除远程的分支
$ git checkout -b serverfix origin/serverfix  // 这样才可以编辑同伴的分支 这样本地的分支被跟踪了
git checkout -b [分支名] [远程名]/[分支名]

远程仓库通常只是一个 纯仓库(bare repository) ——一个没有当前工作目录的仓库。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: