通過命令學git

2021-10-19 10:42:01 字數 2252 閱讀 3896

設定提交**時的使用者資訊

常用命令

遠端操作

分支管理

刪除分支

分支合併

檢視提交歷史

git標籤

配置git和github

菜鳥教程鏈結

git init

git init 資料夾

git add *.c

git add readme

git commit -m '初始化專案版本'
git clone 

git clone

git config --list #顯示配置資訊
進行編輯
git config -e

git config -e --global #針對所有倉庫

#比較檔案不同,暫存區(staging area)和工作區(workspace)的區別

git commit #暫時提交到本地倉庫

git reset #回退版本

gitrm

#刪除工作區檔案

git log #檢視歷史提交記錄

git remote #遠端倉庫操作

git fetch #從遠端獲取**庫

git push #上傳**並合併

git remote add 

git push

建立分支
git branch branchname
切換分支
git checkout branchname
git branch -d branchname
git merge change_site

$ git merge v3

auto-merging readme.md

conflict (content): merge conflict in readme.md

automatic merge failed; fix conflicts and then commit the result.

#新增並修改

#a代表add

#相當於先add,再commit -m 'log'

git commit -am '修改**'

git stautus -s

很神奇

本地專案也會跟著變

本地專案也會變

git checkout 分支名
git log

git blame

gig log --oneline #簡潔版本

理解為書的書籤,相當於對於一些關鍵部分的標記

git tag -a v1.0 -a #選項意為"建立乙個帶註解的標籤"
檢視標籤

git tag --decorate 

git tag

git tag -a -m "runoob.com標籤"

略,之後單獨出

提交**三步

git add 

git commit -m " "

git push origin master

更新**最新

git pull
替換本地改動

git fetch origin

git reset --hard origin/master

每天學幾個Git命令 Git安裝與配置

git安裝 sudo apt get install git sudo yum install git sudo yum install git core在mac os x 上安裝 在mac上,這裡推薦使用homebrew 安裝,具體方法請參考homebrew 的文件 2.然後按預設選項安裝即可。安...

通過翻譯學英語

例項1 漢語 按人口計算,中國是世界上最大的國家 按領土面積計算,是第三大國家,僅次於俄羅斯和加拿大。不好譯文 according to population figure.china is the largest country in the whole world and according t...

Gitlab通過git命令新建分支並提交到遠端倉庫

首先切換到有你需要的 分支上,我以master分支為例 更新當前分支 一般情況下,不更新是不能切換分支的 git pull切換到master分支 git checkout master在輸入 git checkout b 分支名 建立分支,執行完成後,你本地就建立好了你的分支,並且切換到了你剛剛建立...