學習使用GitHub

2021-07-11 16:13:29 字數 1756 閱讀 6482

git add —— 新增

該命令是將一些修改寫進本地記錄裡面,我們把本地記錄叫做索引庫(head緩衝區)

git add -a  //stages all include modified, delete and new

git add . //stages new and modified

git add -u //stages delete and modified

git commit —— 提交

該命令根據索引庫(head緩衝區)中的記錄,將檔案提交到本地倉庫中。

git commit  //open an editor for editting the commit information.

git commit -m git commmit -am

當你僅僅是修改了某些檔案內容,並沒有建立新的檔案,你可以使用git commit -am來省去git add -u這一步。

git pull —— 拉取並合併

當你在乙個本地倉庫中進行了修改並提交到了遠端倉庫,使用這個命令在另外乙個倉庫,pull(拉取)這些修改資訊,來與遠端倉庫同步。

git pull head     //pull the head buffer

git pull

//pull the data from this branch

example:

git pull origin master

git push —— 推送

將本地的資料push(推送)到遠端倉庫。

git push origin master

git push origin test:master //將本地test倉庫的改動推送到遠端master倉庫中

git push origin :test //刪除剛剛推送到遠端倉庫中的test,本地倉庫不會被刪除

git fetch —— 拉取

跟pull有些相像,下面是它們的比較

git fetch origin master:master  //從遠端倉庫master(:master)中拉取下來到master

git diff master //比較本地master倉庫和遠端master倉庫的不同

git merge master //將遠端的master合併到本地master中

//pull只需要一句話

git pull origin master

git clone —— 拷貝遠端倉庫
git clone
git branch —— 分支
//檢視

git branch //列出本地分支

git branch -a //列出本地和遠端分支

git branch -r //列出遠端分支

//建立

git branch //在本地建立乙個新的分支,但是並沒有切換到該分支

git checkout //切換到該分支

git checkout -b //在本地建立乙個分支並切換到該分支

//刪除

github 初步學習使用github

1 1 github簡明教程 1 2 對本地倉庫進行更新 1 3 超級全的github指令 2 常用命令 git add filename 新增檔案到本地index快取區 git add 新增所有檔案到index區 git commit m 將上述檔案新增到head區 git push origin...

github使用學習

提交 獲取文件過程 1.建立乙個資料夾 2.git init 初始化 生成了隱藏的.git資料夾 3.git add path of files 新增要管理的檔案,檔案需要在當前資料夾下,否則報錯 git add 新增當前目錄下所有內容 4.git commit am my commit 引數 am...

學習使用github

首先註冊帳號 登入 建立專案 建立好之後看到有歌http和ssh選擇,我選擇ssh。位址是git github.com firadio filecount.git 然後在shell裡輸入git clone git github.com firadio filecount.git 之後就可以把檔案gi...