Git 日常命令

來源:互聯網
上載者:User

Command Alias(快捷命令設定)

git config --global alias.st status
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.dc dcommit
git config --global alias.rb rebase

Interactive Color(開啟互動色彩)

git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto

User Information(設定使用者資訊)

git config --global user.name "jianingy"
git config --global user.email "detrox@gmail.com"

Clone New Project(複製新項目)

git clone git://gitorious.org/bamboo/mainline.git bamboo

Setup Remote Repository(設定遠程倉庫)

添加(origin 為一個標示,可以隨意更換) 
git remote add origin git@gitorious.org:bamboo/mainline.git
刪除 
git remote remove origin

Operations on Remote Repository(操作遠程倉庫)

提交本地修改(將本地修改提交到遠端master分支 
git push origin master
合并遠程修改(將遠端master分支合并進來 
git pull origin master
刪除遠程倉庫裡的分枝 
git push :branch

Basic Operations(基本操作)

提交修改 
git add /path/to/file
git commit -m reason
提交全部修改 
git commit -a -m reason
建立本地分枝 
git co -b branch_name
查看分枝 
git branch
刪除分枝 
git branch -D branch_name
查看分支之間的差異 
git diff master branch
查看最新版本和上一個版本的差異(一個^表示向前推進一個版本) 
git diff HEAD HEAD ^
查看狀態 
git status
合并分支 
git pull . branch
銷毀自己的修改 
git reset --hard

git-svn (與svn互操作)

從subversion倉庫中複製 
git svn clone https://nlpbamboo.googlecode.com/svn --username detrox
將本地修改提交到subversion倉庫 
git svn dcommit
匯入新的subversion更新 
git svn rebase

轉自:http://tangtong.iteye.com/blog/280386

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.