Git 基本操作

2021-07-11 00:24:55 字數 1267 閱讀 7764

git add

git commit -m 'bugid:6415586: ***xx'

git push origin head:refs/for/main_dev

方式一1. 檢視遠端倉庫

1

$

gitremote

-v

2 ,從遠端獲取最新版本到本地

1

$

gitfetch

origin

master

1

$

gitlog-p

master

..origin

/master

1

2

$

gitmerge

origin

/master

alreadyup-

to-date

以上的方式有點不好理解,大家可以使用下面的方式,並且很安全

方式二1.檢視遠端分支,和上面的第一步相同

2. 從遠端獲取最新版本到本地

1

$

gitfetch

origin

master:

temp

比較本地的倉庫和遠端參考的區別

1

$

gitdiff

temp

命令的意思是:比較master分支(個人理解為「本地master分支」)和temp分支的不同

4. 合併temp分支到master分支(個人理解為「本地master分支」)

1

$

gitmerge

temp

5.如果不想要temp分支了,可以刪除此分支

1

$

gitbranch-d

temp

如果該分支沒有合併到主分支會報錯,可以用以下命令強制刪除git branch -d 《分支名》

總結:方式二更好理解,更安全,對於pull也可以更新**到本地,相當於fetch+merge,多人寫作的話不夠安全。

關於git commit

git commit --amend  重新提交path使用同乙個id

Git基本操作

1.初始化倉庫 git init 2.配置作者資訊 git config global user.email youremail corp.com git config global user.name yourname 3.新增檔案到暫存區 git add git add 新增所有檔案到暫存區 4...

git基本操作

1.先建乙個資料夾 mikdir gittest 這時就會有乙個gittest資料夾,cd gittest 進入這個資料夾 ls一下,就會看到gittest下沒有東西 2.生成乙個git git init cat git 顯示一下所有git 3.建乙個檔案 touch readme.md 這時git...

Git基本操作

21 nov,錦州 同生活中的許多偉大事件一樣,git 誕生於乙個極富紛爭大舉創新的年代。linux 核心開源專案有著為數眾廣的參與者。絕大多數的 linux 核心維護工作都花在了提交補丁和儲存歸檔的繁瑣事務上 1991 2002年間 到 2002 年,整個專案組開始啟用分布式版本控制系統 bitk...