知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

Linux Git command

发布时间:2014-09-05 14:18:34作者:知识屋

Linux Git command
 
git config --global user.name "example"
git config --global user.email "example@example.com"
git config --global core.editor emacs
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'
 
git config --global --list
 
add alias gs='git status' in .bashrc
 
Two ways to get a repository
Clone someone else's - git clone
Make your own - git init
 
git add *.c (add all C source files in the current folder)
git add /*.c (add all C source files in the current folder and all subfolders)
git add . (add everything, be careful)
 
git commit -a
git commit -m <comment>
 
git commit --amend
 
git rm <file> ---- removes <file> from Git and deletes it as well
git rm --cached <file> leaves it hanging in the directory, it's just gone from git
 
git mv <src> <dst>
 
git log
git log <path>
git diff
git diff --cached
 
edit .gitignore --- the files you don't want to save
 
git branch --- inspect the branches
git checkout branch_a --- switch to branch a
git checkout -b branch_b --- create branch b and switch to b
git merge branch_a
git mergetool
 
---
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜