Git操作手冊2

2021-08-27 13:23:50 字數 2866 閱讀 4203

獲取遠端庫到本地庫

xiongmc@xiongmc-desktop:~/project$ git clone [email protected]:home

cloning into 'home'...

remote: counting objects: 88, done.

remote: compressing objects: 100% (77/77), done.

remote: total 88 (delta 30), reused 0 (delta 0)

receiving objects: 100% (88/88), 211.13 kib, done.

resolving deltas: 100% (30/30), done.

進入專案主目錄

xiongmc@xiongmc-desktop:~/project$ cd home/

xiongmc@xiongmc-desktop:~/project/home$ git branch

* master

建立開發分支

檢視當前分支

xiongmc@xiongmc-desktop:~/project/home$ git branch

master

xiongmc@xiongmc-desktop:~/project/home$ git status

# untracked files:

# (use "git add ..." to include in what will be committed)##

.project

# bin/

nothing added to commit but untracked files present (use "git add" to track)

#更新專案以便適合於當前環境 ,進入開發階段。 xiongmc@xiongmc-desktop:~/project/home$ android update project -p . -t android-17

updated and renamed default.properties to project.properties

updated local.properties

no project name specified, using project folder name 'home'.

if you wish to change it, edit the first line of build.xml.

added file ./build.xml

added file ./proguard-project.txt

xiongmc@xiongmc-desktop:~/project/home$ git status

# untracked files:

# (use "git add ..." to include in what will be committed)##

.project

# bin/

# build.xml

# local.properties

# proguard-project.txt

# project.properties

nothing added to commit but untracked files present (use "git add" to track)

檢視當前狀態

xiongmc@xiongmc-desktop:~/project/home$ git status

# changes not staged for commit:

# (use "git add ..." to update what will be committed)

# (use "git checkout -- ..." to discard changes in working directory)##

modified: res/layout-land/home.xml

## untracked files:

# (use "git add ..." to include in what will be committed)##

.project

# bin/

# build.xml

# gen/

# local.properties

# proguard-project.txt

# project.properties

no changes added to commit (use "git add" and/or "git commit -a")

提交開發分支到本地庫。這裡使用 qgit 做到。 xiongmc@xiongmc-desktop:~/project/home$ qgit

xiongmc@xiongmc-desktop:~/project/home$ gitk

xiongmc@xiongmc-desktop:~/project/home$ git status

# untracked files:

# (use "git add ..." to include in what will be committed)##

.project

# bin/

# build.xml

# gen/

# local.properties

# proguard-project.txt

# project.properties

提交本地庫到遠端庫,以便管理**,共其他開發人員使用(或發布終端使用者)

1) 先把git的東西fetch到你本地然後merge後再push

$ git fetch

$ git merge

這2句命令等價於

$ git pull

git 操作手冊

我們先來理解下git 工作區 暫存區和版本庫概念 下面這個圖展示了工作區 版本庫中的暫存區和版本庫之間的關係 圖中我們可以看出此時 head 實際是指向 master 分支的乙個 游標 所以圖示的命令中出現 head 的地方可以用 master 來替換。圖中的 objects 標識的區域為 git ...

Git操作手冊

git config global user.name your name git config global user.email email example.com 注意git config命令的 global引數,用了這個引數,表示這台機器上所有的git倉庫都會使用這個配置,當然也可以對某個倉...

Git 實用操作手冊

首先宣告一下該篇 chat 適合了解並使用過 git 的同學,之前我在 githchat 上分享了一篇 手把手帶你玩轉 git 上面講的內容比較偏基礎一些,非常適合完全沒有接觸過 git 的同學。這篇 chat 更為系統地介紹了,如何通過純命令方式來操作 git。全篇教程是在windows 系統上操...