初次使用github

來源:互聯網
上載者:User

http://wuyuans.com/2012/05/github-simple-tutorial/

 

加單個檔案,並提交

$ git add README
$ git commit -m 'second commit'
$ git remote add origin git@github.com:yourName/yourRepo.git
$ git push -u origin master #[-u | --set-upstream]

加所有檔案
$ git add -A #-A是all的意思
$ git commit -m 'second commit' #-m是給出message,不是modify
$ git push -u origin master

修改檔案後
git add -u #-u是 update的意思
git status
git commit -m 'third test'
git push -u origin master

 

 

利用.gitignore來忽略檔案。

在.git檔案夾裡建立.gitignore檔案。

可以寫檔案夾,也可以寫檔案名稱。

.gitignore
*.cache
*.suo

(http://blog.sina.com.cn/s/blog_81fe9f94010182uz.html)

 

如果之前已經將一些檔案用git add進行跟蹤了,需要利用git rm –cached -r <path>先將其刪除。

git rm --cache -r .httpd.conf

git rm --cache -r project.suo

 

之後再用git add -u.

這樣就不會跟蹤這些檔案了。

 

你可以運行`git reset FILE`, 他可以將File從當前要提交的檔案集合中移除。而且不會改變任何資訊。

 

http://www.stackenqueue.com/questions/108/git-add-%E6%92%A4%E9%94%80

 

git 刪除已刪除檔案

 http://www.cnblogs.com/wangkangluo1/archive/2012/02/04/2337702.html

Update: If you only want to add deleted files, try:

git ls-files --deleted | xargs git rm | git commit

 

git ls-files --modified

git ls-files --others

 

 

Update: If you only want to add deleted files, try:

git ls-files --deleted | xargs git rm | git commit

 

git ls-files --modified

git ls-files --others

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.