git基本操作入門

2021-10-03 06:50:00 字數 1066 閱讀 7080

$ git config --global user.name "your name"

$ git config --global user.email "your [email protected]"

從已有倉庫轉殖

$ git clone url
新建乙個倉庫

$ mkdir project

$ cd project

$ git init

3.1. 建立或修改檔案

3.2. 使用 git add 命令新增新建立或修改的檔案到本地的快取區(index)

$ git add file1 file2 file3
$ git status
$ git

diff --cached

3.3. 使用 git commit 命令提交到本地**庫
$ git commit -a -m "add file"
3.4. (可選,有的時候並沒有可以同步的遠端**庫 )使用git push命令將本地**庫同步到遠端**庫
$ git remote add origin 《遠端倉庫位址》
$ git push origin master
4.分支
$ git branch br_name
$ git branch
$ git checkout br_name
$ git checkout master

$ git merge -m "備註" br_name

$ git branch -d br_name
$ git reset --head head^
git log

Git入門命令 基本操作

建立git倉庫 mkdir gitcd gitgit init2.轉殖版本庫並新增注釋 git clone http 將檔案新增到版本庫中 git add 檢視版本庫狀態 git status發布修改 提交 git commit m 理由 推送到伺服器 git push git pull檢視歷史版本...

Git基礎入門 四 Git基本操作2

忽略檔案 在實際開發過程中總有些檔案無需納入git的管理,比如日誌檔案 臨時檔案等 在這種情況下,我們可以在工作目錄中建立乙個名為.gitignore的檔案,列出要忽略的檔名或者表示式 例 cat gitignore oa log 第一行告訴git忽略所有以.o或.a結尾的檔案 第二行告訴git忽略...

Git入門之Git和GitHub基本操作

github for windows 是github乙個本地客戶端,可以使用github賬號進行登入,管理github專案。功能 1.獲取別人專案 2.分享自己專案 名詞解釋 1.倉庫 repository 2.master 我們電腦裡的目錄稱之為工作區。add操作是把工作區的檔案新增到git版本庫...