開発ツール - Gitのオン

Gitのオン|ツール

このツールをGitは、私はいつも、私はようやく私の考えを実現し、記事を書きたかったです。私が書き始めた前に、自分の意見を表現し、それをツールとして識別されているので、Gitは、単なるツールであり、それは、これらのツールの共通の特徴を持っている必要があります、のようなオブジェクト指向のタイプを理解するためにアヒルを使用してください~~

序文

目前所有的文章思想格式都是:知识+情感。
知识:对于所有的知识点的描述。力求不含任何的自我感情色彩。
情感:用我自己的方式,解读知识点。力求通俗易懂,完美透析知识。

ディレクトリ

1.Git介绍
2.Git下载安装
3.Git的基本使用
   3.1 小结git基本使用
4.Git的高级使用
    4.1.Github使用
    4.2.Git分支使用
5.Git总结

テキスト

コンテンツは、テキスト、ダウンロードしてgitのインストールが含まれており、実際の動作と基本的な使用にGitを紹介し、高度な使用は高度なセクションでインタラクティブな使用のgitとgithubのを伴います。

Gitのイントロダクション

行うにはGitのバージョン管理、他の多くのツールがありますよう、またを達成することができSVN、クラウドコードようにと。
バージョン管理は、ローカルおよびリモートの、分割されgitのとgithubの非常に良いバージョン管理を実現することができ、かつ実際の使用にも発生する可能性がありgitlabとジェンキンスが、継続的インテグレーションツールを行っている、ああ、覚えているだけのツールを

Gitリポジトリをダウンロードしてインストール

1. 公式サイト: https://git-scm.com/downloads
自分のニーズにダウンロード版、インストールは、最も一般的なソフトウェアのインストールで、少し問題が~~
注意:ソフトウェアのすべてを、限り一切料金はありませんとして公式サイトああをダウンロードしてください!〜

2、上のgitのリファレンスブック(UK、私は〜アム)
https://git-scm.com/book/en/v2

Gitリポジトリの基本的な使用

1、開いコンテキストGitのバッシュ、マウス、動作図
1

これは新しいウィンドウが開き、図を参照してください、以上の百倍美しいPowerShellウィンドウ、何~~~キーはありません、あなたが直接、古い鉄FUBUフー〜、たとえば、Linuxのコマンドを使用することができます
2

2、コマンドのgitのバージョンを参照してください
。この時に評価の違いを、コマンドラインで直接コピー]を選択します選択することはできません......(相互作用を達成することができipython、我々はipythonの対話型のコマンドラインを体験したいことがあります。)

Administrator@kate_liu MINGW64 ~/Desktop
$ git --version
git version 2.22.0.windows.1

3. 当社のヘルプドキュメントコマンドは、
私はすべての内容を書きたい、感じのヘルプファイルに書き込まれ、ハッハッハ~~
:、特に不慣れなツールをツールを使用して最初のバージョンを見て、ヘルプメッセージを見て、またはあなたは虎のような激しいを操作することができますか?

Administrator@kate_liu MINGW64 ~/Desktop
$ git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
   clone      Clone a repository into a new directory
   init       Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
   add        Add file contents to the index
   mv         Move or rename a file, a directory, or a symlink
   reset      Reset current HEAD to the specified state
   rm         Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
   bisect     Use binary search to find the commit that introduced a bug
   grep       Print lines matching a pattern
   log        Show commit logs
   show       Show various types of objects
   status     Show the working tree status

grow, mark and tweak your common history
   branch     List, create, or delete branches
   checkout   Switch branches or restore working tree files
   commit     Record changes to the repository
   diff       Show changes between commits, commit and working tree, etc
   merge      Join two or more development histories together
   rebase     Reapply commits on top of another base tip
   tag        Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
   fetch      Download objects and refs from another repository
   pull       Fetch from and integrate with another repository or a local branch
   push       Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.

4.今すぐ開始する必要があり、説明書のドキュメントに従って初期化するだけでなく、空白のフォルダはそれを試して見つけ、!
1)新規フォルダtest_git -------
2)コマンドラインで新規フォルダをカットします------ Linuxディレクトリの知識、CDのtest_gitでカット
コマンドを実行する3):INITはgit
4)、フォルダ内のファイル.gitを隠しファイルを表示するには、中に行くとハを参照して、以下のコマンドで見ることができます

Administrator@kate_liu MINGW64 ~/Desktop
$ cd test_git/
Administrator@kate_liu MINGW64 ~/Desktop/test_git
$ git init
Initialized empty Git repository in C:/Users/Administrator/Desktop/test_git/.git/
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ cd ./.git/
Administrator@kate_liu MINGW64 ~/Desktop/test_git/.git (GIT_DIR!) 
$ ls
config  description  HEAD  hooks/  info/  objects/  refs/

現在のファイルに新しいファイル:a.py. するために、追加の実行ステージングエリアにカレントディレクトリのファイルを追加します

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ touch a.py
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ ls
a.py
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git add a.py

6. gitのは、現在のビューの作業領域の状態、状況を

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   a.py

その後、することができ、B.TXT、c.mdなど、現在の作業領域のステータスを表示し、ステージングエリアに追加:7.あなたは、たとえば、ファイルを作成し続けることができ、現在のファイルのすべてを表現するために、追加後に使用します。

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   a.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        b.txt
        c.md
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git add .

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   a.py
        new file:   b.txt
        new file:   c.md

8.ステージング領域のファイル、gitリポジトリに提出さは、-mをコミット使用しています。そして、現在のワークスペースのgitのステータスを表示します。
注:我々は、この場合には自分のユーザー名とメールボックスハ~~(私はすでに従事されている設定、独自のメッセージgitのに応じてエラーがあるかもしれません、それは、提出の失敗で、gitのは、提出されたかを知る必要があり、ここであなたは〜、エンド構成ヘクタール、百度を所有することができ、あなたが使用することができます猫の設定は、彼らが現在設定されているユーザー情報を表示こちらをもグローバルな量--globalユーザー情報を設定するために使用することができます。)

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git commit -m 'First commit code ..'
[master (root-commit) 7008e7d] First commit code ..
 3 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a.py
 create mode 100644 b.txt
 create mode 100644 c.md

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git status
On branch master
nothing to commit, working tree clean

9.この時点でいくつかのファイルを作成したり、ファイルの内容を変更し、続けることができますコミット提出する追加複製します。

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ echo hello git! >> b.txt

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ cat b.txt
hello git!

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ touch d.doc

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git add .
warning: LF will be replaced by CRLF in b.txt.
The file will have its original line endings in your working directory

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git commit -m 'Create new file d.doc and modify b.txt.'
[master 2dc8bcb] Create new file d.doc and modify b.txt.
 2 files changed, 1 insertion(+)
 create mode 100644 d.doc

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git status
On branch master
nothing to commit, working tree clean

10. logコマンドを使用して提出されているログ

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git log
commit 2dc8bcb9dc11aa2ffb972302cd0748398f9747a8 (HEAD -> master)
Author: Administrator <[email protected]>
Date:   Mon Jul 22 22:02:59 2019 +0800

    Create new file d.doc and modify b.txt.

commit 7008e7dd988b505063e94e45af68e8a4c9c1845a
Author: Administrator <[email protected]>
Date:   Mon Jul 22 21:58:24 2019 +0800

    First commit code ..

11.使用するバージョンのロールバックにリセットコマンドを前に、直接ハをしようとするために行こう!〜〜この時点で、彼はちょうど作成した論文を読んでいなかったし、ファイルの変更を見て、また見たことがありません。(彼はコードを書いた場合、あなたは??ハングアップしていない、あなたはまた、幸いにも自分の演奏ロールバックすることができます)

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git reset --hard 7008e7dd988
HEAD is now at 7008e7d First commit code ..
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ ls
a.py  b.txt  c.md

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ cat b.txt

12.ファイル、第1の使用時に技術革新にロールバックし、ファイルを変更し続けREFLOGは、すべてのログを表示、ローカルデータウェアハウスのためのすべてのgitのログ操作を見ることができ、この場合には、しかし、ログはジャーナルの現在のバージョンを確認することができますそれは不完全です。

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git reflog
7008e7d (HEAD -> master) HEAD@{0}: reset: moving to 7008e7dd988
2dc8bcb HEAD@{1}: commit: Create new file d.doc and modify b.txt.
7008e7d (HEAD -> master) HEAD@{2}: commit (initial): First commit code ..

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git reset --hard 2dc8bcb
HEAD is now at 2dc8bcb Create new file d.doc and modify b.txt.

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ ls
a.py  b.txt  c.md  d.doc

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ cat b.txt
hello git!

基本的な使用Gitの概要

初期の出発からの基本的な使用gitのは、ステージング領域にコードを提出した後、スクラッチ領域からのローカルバージョンに提出され、ロールバックの独自のバージョンを実行するために、あなたはコミットログを表示するには、任意の時点での作業ディレクトリの状態を表示することができます。
あなたは、必ずしも、コマンドを覚えておく必要がありますする必要があります。

git init
git status
git add .
git commit -m 'information'
git log
git reser --hard 'back code'
git reflog

この時点で、我々は図を参照してください、バージョン管理、作業領域のインタラクティブなビューおよびステージングエリアとゾーンのバージョンを見ることができます。
図3

Gitリポジトリの高度利用

この場合には、自分のgithubのを見て行く必要があるようにgitを使用しての基礎の終了後、先輩は、リモコンを使用する必要があります~~~ Geshaある
GitHubの公式ウェブサイト:ます。https://github.com/

Githubの使用

地元のクローンのターゲットを見つけるためにgithubのプロジェクトログオンし、

2.その後、リポジトリを作成し、リポジトリの名前と説明を記入し、新倉庫--newリポジトリを作成します。

3.コピーしたリンクHTTPSは現在のリポジトリに対応し、ローカルにgitのリモート、https://github.com/Kate-liu/2109git.git起源を追加し、この時間は、それはリモート倉庫が取り組む実行oringinに追加さは、今することができますgitのことプッシュ、githubのにデータを遠隔地のローカルバージョン。下記を参照してください。
これは、SSH認証をポップアップgithubのようなあなたのユーザー名とパスワードを入力します。
注意:良い倉庫、次の基本的なコマンドを作成する書かれている、それが直接コピーすることができます〜

Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git remote add  origin https://github.com/Kate-liu/2109git.git
Administrator@kate_liu MINGW64 ~/Desktop/test_git (master)
$ git push -u origin master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 6 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (6/6), 473 bytes | 473.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/Kate-liu/2109git.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

あなた自身4. ビューgithubの公式サイトで、現在のコードリポジトリには、次すでに地元の複数のファイルに登場していない、あなたはまた、ファイルの内容を見ることができ、これはキーではありませんを参照してください。あなたは直接githubの上の枝などを見ることができます。

5.今、あなたは、リモートでコードをマスターする必要があり、ローカルで引っ張っcloneコマンドを使用します新しいフォルダ、new_git_testを作成し、新しいファイルにgitのコマンドラインをカットし、コマンドを実行するgitのクローンhttps://github.com/Kate-liu/2109git.git、独自のリモートでコードリポジトリを見ることができる瞬間を待ちます直接ダウンドラッグ~~

Administrator@kate_liu MINGW64 ~/Desktop
$ mkdir new_git_test

Administrator@kate_liu MINGW64 ~/Desktop
$ cd new_git_test/

Administrator@kate_liu MINGW64 ~/Desktop/new_git_test
$ ls

Administrator@kate_liu MINGW64 ~/Desktop/new_git_test
$ git clone https://github.com/Kate-liu/2109git.git
Cloning into '2109git'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 1), reused 6 (delta 1), pack-reused 0
Unpacking objects: 100% (6/6), done.

Administrator@kate_liu MINGW64 ~/Desktop/new_git_test
$ ls
2109git/

Administrator@kate_liu MINGW64 ~/Desktop/new_git_test
$ cd 2109git/

Administrator@kate_liu MINGW64 ~/Desktop/new_git_test/2109git (master)
$ ls
a.py  b.txt  c.md  d.doc

6.まあ、今のように、私のマニュアルに従って、マネージコードで完了することができ、そしてgithubのを遠隔操作することができます。次は、実際の運用環境では、最後に、それは十分に詳しくない表現かもしれないが、私がしようと、見てみましょう~~

7.自分のクローンがある場合は、ローカルコードにプルアップすることができます別のアイデアは、以下を参照してください:
1)独自のローカル最初に初期化されます。init gitの
2)リモート・ウェアハウス・アドレスを追加します:gitのリモート起源を追加HEEP:// XXXXX
。3)リモートでコードが、プルダウン、使用:gitのプル原点マスター

Administrator@kate_liu MINGW64 ~/Desktop
$ mkdir pull_test

Administrator@kate_liu MINGW64 ~/Desktop
$ cd pull_test/

Administrator@kate_liu MINGW64 ~/Desktop/pull_test
$ git init
Initialized empty Git repository in C:/Users/Administrator/Desktop/pull_test/.git/

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git remote add origin https://github.com/Kate-liu/2109git.git

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git pull origin master
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 1), reused 6 (delta 1), pack-reused 0
Unpacking objects: 100% (6/6), done.
From https://github.com/Kate-liu/2109git
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ ls
a.py  b.txt  c.md  d.doc

Gitのブランチを使用します

使用のgit gitのブランチはケア、合併の特に最後の枝、エヘン〜あなたが知っている、合併の必要性の中で最もです!〜
1.アイデアは別で実現することができる直前に、最初の前に自分のコードを見つけ、ブランチを作成します。ローカルフォルダ、pull_testファイル保存場所にそのコードを引っ張ります。分岐gitのブランチdevの作成作成し、する、のdevの枝の枝を見てgitのブランチを使用します。

Administrator@kate_liu MINGW64 ~/Desktop
$ cd pull_test/

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ ls
a.py  b.txt  c.md  d.doc

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git branch dev

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git branch
  dev
* master

2.ハンドオーバブランチ、マスタープロジェクトのドキュメントのブランチ上のこの時間は、枝を使用してDEVに切り替えることができるのgitのチェックアウトDEV、ブランチの切り替えを。

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git checkout dev
Switched to branch 'dev'

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git branch
* dev
  master

3.この時点では、DEV枝上にあってもよいファイルdev.py、dev.mdを作成し、そして地元の行政区域に提出ステージングエリアに追加しました。

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ touch dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ touch dev.md

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ ls
a.py  b.txt  c.md  d.doc  dev.md  dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git add .

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git commit -m 'dev branch create new file.'
[dev 1e7930f] dev branch create new file.
 2 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 dev.md
 create mode 100644 dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
nothing to commit, working tree clean

4. **それを入力して、自分のアイデンティティ情報を確認する必要があるかもしれません** Gitのプッシュ原点DEV直接ではなく、覚えて、リモートgithubのにdevの枝を提出してください。この時点では、枝の重要性を示しており、githubのをログに記録し、彼はちょうど作成したものを見ると、あなたはあなただけのdevの枝の下に作成したファイルを表示することができますが、あなただけの下に、独自のmasterブランチを作成したフォルダにはファイルが存在しないことができます。

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git push origin dev
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 269 bytes | 269.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/Kate-liu/2109git.git
 * [new branch]      dev -> dev

この場合に、分岐DEV、データファイルは、変更を行い、dev.md内容を変更し、GitHubのに提出します

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ echo I am dev test code! >> dev.md

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ cat dev.md
I am dev test code!

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
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:   dev.md

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

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git add dev.md
warning: LF will be replaced by CRLF in dev.md.
The file will have its original line endings in your working directory

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git commit -m  'modify dev.py content.'
[dev ec34b39] modify dev.py content.
 1 file changed, 1 insertion(+)

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
nothing to commit, working tree clean

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git push origin dev
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 284 bytes | 284.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/Kate-liu/2109git.git
   1e7930f..ec34b39  dev -> dev

6.この時点では、githubの上のコードを提出することは、当、そして今、一つのことを行う必要があり、それがされている必要がありますのブランチをマージしますしかし、分岐マスターに変更し、gitのマージDEV **行います。**これは彼らのDEVのコンテンツは、独自のmasterブランチにマージ完了時に、githubの上の導出の内容を見てみましょう。

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git checkout master
Switched to branch 'master'

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git merge dev
Updating 2dc8bcb..ec34b39
Fast-forward
 dev.md | 1 +
 dev.py | 0
 2 files changed, 1 insertion(+)
 create mode 100644 dev.md
 create mode 100644 dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ ls
a.py  b.txt  c.md  d.doc  dev.md  dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git push origin master
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/Kate-liu/2109git.git
   2dc8bcb..ec34b39  master -> master

7.この時点で、私たちは、コードは非常に精通する必要があります何のためにプッシュと思うし、この時間は私たちのローカルおよびリモートのGitHubの内容が同じで、コンテンツとのdevのブランチとマスターブランチがマージされましたよく、今、新たな挑戦を開始します。
1)ハンドオーバブランチDEVへ
2)コンテンツがdev.md文書ファイルをc.md変更するには
)ローカルコンテンツ3に提出し、githubのに同期されます。

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git checkout dev
Switched to branch 'dev'

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ ls
a.py  b.txt  c.md  d.doc  dev.md  dev.py

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ echo new code for dev branch. >> c.md

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ echo new code for dev branch.6666 >> dev.md

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ cat dev.md
I am dev test code!
new code for dev branch.6666

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ cat c.md
new code for dev branch.

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
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:   c.md
        modified:   dev.md

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

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git add .
warning: LF will be replaced by CRLF in c.md.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in dev.md.
The file will have its original line endings in your working directory

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   c.md
        modified:   dev.md


Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git commit -m 'modefy new code for c.md and dev.md'
[dev 97eda8a] modefy new code for c.md and dev.md
 2 files changed, 2 insertions(+)

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git status
On branch dev
nothing to commit, working tree clean

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (dev)
$ git push origin dev
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 372 bytes | 372.00 KiB/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/Kate-liu/2109git.git
   ec34b39..97eda8a  dev -> dev

8.この時点で、masterブランチブランチdevのにマージする必要があります。
1)マスターブランチへ
2)変更された値をc.md、およびGitHubのを提出する
。3)分岐をマージ、GitのマージDEV、---- --- CONFLICT(コンテンツ)与えられる下記参照

Administrator@kate_liu MINGW64 ~/Desktop/pull_test (master)
$ git merge dev
Auto-merging c.md
CONFLICT (content): Merge conflict in c.md
Automatic merge failed; fix conflicts and then commit the result.

9.手動で開くc.mdファイルにエラーメッセージは、紛争解決にファイル
コンテンツc.mdはこのようなものです、競合を解決するために、手動でマージし、去るするかを選択する必要があり====以下を参照してください。変更は、ローカルに提出し続けることを完了し、githubのに同期させることができます。

<<<<<<< HEAD
I am master new modefy infomation.
=======
new code for dev branch.
>>>>>>> dev
~

10.この時点で、私たちは枝をマージする際に発生する競合を完了した、と手動でマージして、問題を解決するために、すべての支店およびすべてのコードはgithubの上で見ることができ、かつDEVブランチとマスターデータが同じブランチです。

Gitの概要

もともと、私はこの部分の内容を書き込むするつもりはないが、それは、自分自身がより良い全体の動作過程を振り返ってみるようにするために、私は再び全体のプロセスを避けることにしました!

Gitは使用された後、あなたが簡単に見ることができれば、それらをすべて1を一覧表示するにはgitコマンドのすべてを要約します。

git --vertion
git --help
git init 
git config user.name 你的用户名
git config user.email 你的邮箱
git config --global user.name 你的用户名
git config --global user.email 你的邮箱
git status 
git add 文件名
git add .
git rm --cached 文件名  # 将提交到暂存区的文件状态删除,不删除本地文件
git rm -f 文件名   # 直接将暂存区的文件状态与本地文件直接删除
git mv  原文件名 新文件名  # 暂存区的文件重命名
mv 原文件名 新文件名  # 工作区的文件重命名
git commit -m '提交的描述信息'
git log
git git log --pretty=oneline  # 一行展示日志信息
git log --oneline
git reflog  # 查看每一次版本记录历史
git reset --hard 日志记录提交的hash值
git reset --hard HEAD^  # 版本回退一次
git reset --hard HEAD^^  # 版本回退两次
git reset --hard HEAD ~n  # 版本回退n次
git diff 文件名     #  工作目录与暂存区比较文件的差异
git diff --cached   #  比较暂存区与版本区非区别

git remote -v   # 查看当前远程地址的别名
git remote add 别名 地址  #添加远程地址与别名
git push -u 别名 分支    # 第一次推送
git push 别名 分支   # 更新之后的推送
git pull 别名 分支  # 相当于先fetch 分支,在merge或者rebase分支
git clone 仓库地址  # 直接将整个仓库克隆下来
git branch   # 查看所有分支
git branch -v  # 查看所有分支与上次commit的信息
git branch -b 分支  # 相当于创建分支并且切换到分支上
git branch -D  # 强行删除没有合并到master分支的branch
git ranch 新分支名   # 创建新分支 
git checkout 分支名   # 切换分支
git checkout -b 分支名   # 切换分支
git checkout -d 分支名   # 删除分支
git merge 分支名  # 合并分支
版本冲突: 手动修改,重新提交
git rebase 分支名  # 合并分支,并且将记录合并到一条主线上,保证提交记录整洁
版本冲突: 手动修改,git rebase --skip

git stash # 将当前的工作状态保存修改bug
git stash list  # 查看保存的列表
git stash apply stash@{n}  # 恢复到之前的n时刻的状态,不删除保存列表
git stash drop  #  删除保存的数据
git pop #  恢复到之前的状态,删除保存列表

git tag 标签名   # 创建标签名
git tag  # 查看标签名字
git tag 标签名 提交的hash  # 为某一次提交指定标签
git show 标签名  # 查看标签的详细信息
git tag -a 标签名 -m '描述信息' 提交的hash  # 添加描述信息
git tag -d 标签名  # 删除标签
git push origin 标签名  # 推送标签到远程
git push origin --tags  # 推送所有标签到远程
git push origin :refs/tags/标签名   # 删除远程库标签

git log --graph --pretty=oneline --abbrev-commit  # 分支合并缩略图
git log --graph  # 分支合并图

忽略某些文件,编写.gitignore文件,配置文件参考:https://github.com/github/gitignore
fork: fork代码到本地之后,可以修改代码,之后创建pull request
实际开发中: master分支是线上代码分支,dev是开发分支,review分支(代码的review),每一个人有自己的开发分支,bug分支(专门处理mater分支的bug.)

結論

最後に、使用gitの上で仕上げ、そしておそらくあなたが開始すると半分の時間を終えたときに、何かをピックアップする必要があり、自分自身の多くのことを思い出すことを余儀なくされますので、それは、フィニッシュしたくなかった初めに、彼らの新しいロードコースについて話私はこの事を知っていない、あまりにもない、ああ見に戻ってする必要があります!!!しかし、彼らは本当にまだ少し怠惰だった!しかし、最終的には弾丸をかむと乾く!
もちろんこのテキスト、まだかなり完全な、しかしエントリ-gitのは十分に完全に熟練を持っているためではないが、私はあなたが読んでお楽しみください~~~これは深さであります長い記事、ハ〜

おすすめ

転載: www.cnblogs.com/Kate-liu/p/11237700.html