git 基本用法

2022-08-27 22:24:12 字數 1136 閱讀 2799

git reset --hard head~1

mkdir 檔名

cd 檔名

touch index.html

vim 文字名 退出時 按esc鍵 輸入:wq 回

git init

git add

git add .

git status

git clone (git 檔案鏈結)

pwd

git commit -am "專案名

"

git remote add origin 鏈結(git建立的檔案鏈結)

git remote rm origin

git push -u origin master(分支名; 預設master)
git push -f origin master (強制上傳)

git config --global credential.helper store

git branch masters

git checkout mastars

git stash    備份本地檔案

git checkout -b masters(分支名masters)

在執行 git status || git add .時  

another git process seems to be running in this repository, e.g. an editor opened by 'git commit'.

解決方法

移除 .git/index.lock

$ rm -f ./.git/index.lock

git 基本用法

git相對於其他的版本控制,優勢在於分支管理。幾個常見情況及分支使用方法。1 對於自己的 修改後,卻已經不知道伺服器上的 是否已經發生改變。此時想上傳自己的 1 在master上建立分支mysrc 2 switch到mysrc分支,進行修改 3 修改好 後,進行git commit操作 4 swit...

GIT基本用法

下面是乙個在本地建立乙個git庫的步驟 1 初始化倉庫,並配置一些必要的變數 git init git config global user.name wensf git config global user.email wensf manridy.com 2 新增檔案過濾規則檔案 可選 檔名為 g...

Git基本用法

首次設定 git config global user.name 名字 git config global user.email email 複製 初始化git倉庫 目錄下沒有.git資料夾 git init 複製 git remote add origin 專案位址 複製 git clone 專案...