1. 程式人生 > >Git 本地倉庫操作

Git 本地倉庫操作

[email protected] MINGW32 /
$ pwd
/

[email protected] MINGW32 /
$ cd hsg77

[email protected] MINGW32 /hsg77 (master)
$ cd HelloWorld

[email protected] MINGW32 /hsg77/HelloWorld (master)
$ <span style="color:#ff0000;">git status</span>
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   readme.txt

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

[email protected]
MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff6666;">git status</span> On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt Untracked files: (use "git add <file>..." to include in what will be committed) LICENSE.txt no changes added to commit (use "git add" and/or "git commit -a")
[email protected]
MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff6666;">git add readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff6666;">git add LICENSE.TXT</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: readme.txt Untracked files: (use "git add <file>..." to include in what will be committed) LICENSE.txt
[email protected]
MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git add LICENSE.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: LICENSE.txt modified: readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git commit -m "understand how stage works"</span> [master 9efd81f] understand how stage works 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 LICENSE.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master nothing to commit, working directory clean [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">cat readme.txt</span> Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. [email protected] MINGW32 /hsg77/HelloWorld (master) $ git status On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git add readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">cat readme.txt</span> Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. Git tracks changes of files. [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git commit -m "git tracks changes"</span> [master de726ef] git tracks changes 1 file changed, 2 insertions(+), 1 deletion(-) [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git diff HEAD -- readme.txt</span> diff --git a/readme.txt b/readme.txt index 538fff5..e9a82f0 100644 --- a/readme.txt +++ b/readme.txt @@ -2,4 +2,4 @@ Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. -Git tracks changes. \ No newline at end of file +Git tracks changes of files. \ No newline at end of file [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git add readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git commit -m "of file"</span> [master 167bbdb] of file 1 file changed, 1 insertion(+), 1 deletion(-) [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="background-color: rgb(255, 255, 255);"><span style="color:#ff0000;">cat readme.txt</span></span> Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. Git tracks changes of files. [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git diff HEAD -- readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">cat readme.txt</span> Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. Git tracks changes of files. My stupid boss still prefers SVN. [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git checkout --readme.txt</span> error: unknown option `readme.txt' usage: git checkout [<options>] <branch> or: git checkout [<options>] [<branch>] -- <file>... -q, --quiet suppress progress reporting -b <branch> create and checkout a new branch -B <branch> create/reset and checkout a branch -l create reflog for new branch --detach detach the HEAD at named commit -t, --track set upstream info for new branch --orphan <new-branch> new unparented branch -2, --ours checkout our version for unmerged files -3, --theirs checkout their version for unmerged files -f, --force force checkout (throw away local modifications) -m, --merge perform a 3-way merge with the new branch --overwrite-ignore update ignored files (default) --conflict <style> conflict style (merge or diff3) -p, --patch select hunks interactively --ignore-skip-worktree-bits do not limit pathspecs to sparse entries only --ignore-other-worktrees do not check if another worktree is holding the given ref --progress force progress reporting [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git checkout -- readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">cat readme.txt</span> Git is a version control system. Git is a distributed version control system. Git is free software distributed under the GPL. Git has a mutable index called stage. Git tracks changes of files. [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git add readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git reset HEAD readme.txt</span> Unstaged changes after reset: M readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a") [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git checkout -- readme.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master nothing to commit, working directory clean [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git add test.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git commit -m "add test.txt"</span> [master ba74144] add test.txt 1 file changed, 1 insertion(+) create mode 100644 test.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ pwd /hsg77/HelloWorld [email protected] MINGW32 /hsg77/HelloWorld (master) $ ls LICENSE.txt readme.txt test.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">rm test.txt</span> [email protected] MINGW32 /hsg77/HelloWorld (master) $ ls LICENSE.txt readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git status</span> On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: test.txt no changes added to commit (use "git add" and/or "git commit -a") [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git rm test.txt</span> rm 'test.txt' [email protected] MINGW32 /hsg77/HelloWorld (master) $ ls LICENSE.txt readme.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git commit -m "remove test.txt"</span> [master a28abcf] remove test.txt 1 file changed, 1 deletion(-) delete mode 100644 test.txt [email protected] MINGW32 /hsg77/HelloWorld (master) $ <span style="color:#ff0000;">git checkout -- test.txt</span> error: pathspec 'test.txt' did not match any file(s) known to git. [email protected] MINGW32 /hsg77/HelloWorld (master) $

相關推薦

Git 本地倉庫操作

[email protected] MINGW32 / $ pwd / [email protected] MINGW32 / $ cd hsg77 [email protected] MINGW32 /hsg77 (master) $ c

git本地倉庫簡單操作

#初始化本地git倉庫 Mac-mini:learn_git wengjianhong$ git init Initialized empty Git repository in /Volumes/data/1.learning/2.operation/7.tools/1.

Git 本地倉庫常用操作

1.安裝git 在Ubuntu上安裝git sudo apt-get install git 2.初始化git  #告訴git,自己的名字與郵箱 git config --global user.name "Your Name" git config --global

【tool】git gui本地倉庫操作

本篇文章將介紹git gui 本地倉庫的操作,方便大家在本地進行程式碼的檢視,對於多個版本的程式碼再也不用儲存多個包了。 ============================================================================

Git詳解 一 (Git介紹,單人本地倉庫操作

1.Git簡介 Git Git 是目前世界上最先進的分散式版本控制系統(沒有之一) 作用 原始碼管理 為什麼要進行原始碼管理? 方便多人協同開發 方便版本控制 Git管理原始碼特點 1.Git是分散式管理.伺服器和客戶端都有版本控制能力,都能進行程式碼的提交、合併、… 2.Git會在根

Git本地倉庫使用——2017.07.27

bsp 代碼 tps one spa sta mkdir init 查詢 今天主要是使用Git從遠程倉庫下載代碼庫,主要熟悉了這樣幾個命令。 $ cd d:git //盤符切換 $ mkdir delta

Git如何克隆Gitlab?Git本地倉庫如何上傳Gitlab?

app post dbo local git clone add 查看 pre 一次  首先確保本機已經安裝上Git,其次確認可以正常訪問Gitlab服務器  環境:   Git:Centos 7.x 192.168.126.138   Gitlab: Centos7

Git 本地倉庫提交到遠程倉庫

就是 git init 初始 body rem 倉庫 git add div post 1.git init 初始化本地倉庫 2.git add README.md 添加 3.git add * 加入所有項目 4.git status 檢查狀態 如果都是綠的就是成功的 5.

git本地倉庫關聯多個remote,怎麽用本地一個分支向不同remote不同分支推送代碼

mage pos 後繼 pre bsp 一次 nbsp 技術 text 我想這個問題,是大家關註的問題,這個問題,我非常關註。 背景:在公司開發項目,我們一般都要把項目推送到公司領導創建的一個遠程倉庫裏邊去,但是我們同時也有自己的小倉庫,這樣的話,如何方便的將我們的代

IDEA將Git本地倉庫Push至遠程倉庫

idea 本地倉庫 tps .net csdn http blank 項目 mage 轉自:https://blog.csdn.net/qq_15653601/article/details/79870996 本地本地倉庫項目:IDEA將Git本地倉庫Push至遠程倉庫

Git本地倉庫與Github遠端倉庫關聯

1.從遠端克隆一份到本地:git clone Git支援HTTPS和SSH協議,SSH速度更快 $ git clone [email protected]:zkk/xx.git 2.本地庫關聯遠端庫,在本地倉庫目錄執行命令: $ git remote add origin

git本地倉庫 push到遠端倉庫出現錯誤

  ! [rejected] master -> master (fetch first) error: failed to push some refs to hint: Updates were rejected because the

SourceTree之Git本地倉庫建立

一:Git倉庫簡介:                 倉庫也叫作版本庫,可以簡單理解為一個目錄,這個目錄下的所有檔案都可以被Git管理,                  每個檔案的修改,刪除Git都可以跟蹤。這樣的話,我們不管對檔案進行了什麼樣的修改,          

Git 本地倉庫推送多個遠端倉庫

使用: git remote add [name,預設:origin] [url,遠端倉庫地址https] 可以給我們的本地倉庫增加遠端倉庫的連線(推送)地址。 所以只要指定的[name] [url]都不一致,便可以給本地倉庫增加多個遠端倉庫。 示例 如下圖:

git本地倉庫關聯多個遠端倉庫

直接貼程式碼: [email protected] MINGW32 ~/IdeaProjects/myBoot (master) $ git remote add originlocal h

git 本地倉庫與遠端倉庫關聯

一、直接從遠端倉庫拉取專案           在github或是其他一些基於git的平臺上,複製遠端倉庫的連結。然後在本地資料夾中使用git clone ‘遠端倉庫連結’命令來將遠端倉庫的專案拉取到本地。 二、本地倉庫建立專案,推送到遠端  1 >>

git本地倉庫

// 傳檔案到github git add src(某個資料夾)            // 要增加的檔案     git commit -m "資訊"   &

git 本地倉庫資訊的查詢

本地倉庫資訊查詢操作 1.1  git status   檢視當前暫存區狀態   git  status   顯示當前分支資訊;   提交的目的分支資訊;   git 管理的有修改的檔案;   當前倉庫未被 git 管理的檔案;    1.2  git log

git 本地倉庫信息的查詢

inf 暫存 .com 修改 歷史 com http id號 狀態 本地倉庫信息查詢操作 1.1 git status   查看當前暫存區狀態   git status   顯示當前分支信息;   提交的目的分支信息;   git 管理的有修改的文件;  

git本地倉庫不顯示加號和對號

檢視電腦的使用者名稱是否是中文。假如是中文的話,修改成英文。 修改使用者名稱的方法如下: 1.在控制面板-〉使用者帳戶中將帳戶A改名為B。  2.開啟C:\Users或“使用者”資料夾,將資料夾A重新命名為B。(假如出現資料夾正在使用無法被重新命名的情況,就檢查是否有未關