git forkブランチからコミットへの基本操作

4731 ワード

Forkブランチ
  • forkボタンをクリック[外部チェーン画像の転送に失敗し、ソース局に盗難防止チェーン機構がある可能性があり、画像を保存して直接アップロードすることを提案する(img-jcIJogSX-1575370862707)(https://github.com/aoeivu/aoeivu.github.io/blob/master/posts/2019/12/03/1.jpg?raw=true)]
  • 自分のnamespaceを選択してforkが
  • を完了するのを待つ
  • 自己gitのブランチを表示する
  • フォーク分岐の内容を引く
  • gitファイルを格納するための新しいパス:H:10_Git\python
  • フォルダに入って右クリック->Git Bash Here
  • をクリック
  • ポップアップされたGitウィンドウに次のコマンドを入力フォルダ
    git init
    
    を初期化すると、次のようなメッセージが表示されます.
  • 自分のforkのブランチに入り、コピー
  • をクリックします.
  • GitのDOSウィンドウ入力に戻り、clone後にコピーされたurlとなり、倉庫クローンが完了するのを辛抱強く待つ
    Initialized empty Git repository in H:/10_Git/python/.git/
    
    は、次のように戻る
    git clone [email protected]:Flynn.Chen/python.git
    
  • を見ることができます.
  • gitウィンドウを閉じて再開gitウィンドウを開く次のコマンド
    $ git clone [email protected]:Flynn.Chen/python.git
     Cloning into 'python'...
     remote: Enumerating objects: 2558, done.
     remote: Counting objects: 100% (2558/2558), done.
     remote: Compressing objects: 100% (970/970), done.
     remote: Total 2558 (delta 1573), reused 2558 (delta 1573)
     Receiving objects: 100% (2558/2558), 1.06 GiB | 11.08 MiB/s, done.
     Resolving deltas: 100% (1573/1573), done.
     Checking out files: 100% (64/64), done.
    
    を入力と、見えない場合はGit DOS
    git branch -r
    
  • を複数回閉じて再開する.
  • developブランチに切り替えるBUG修正
    $ git branch -r
    origin/HEAD -> origin/master
    origin/develop
    origin/master
    
    を行うと、次のような内容が戻ることがわかる
    git checkout develop  
    
  • .
  • 任意のバグを修正し、現在のブランチステータス
    $ git checkout develop
    Switched to a new branch 'develop'
    Branch 'develop' set up to track remote branch 'develop' from 'origin'.
    
    を表示すると、gitignoreファイル
    git status
    
  • が修正(modified)されていることがわかります.
  • 変更されたファイルをコミットする
    $ git status
     On branch develop
     Your branch is up to date with 'origin/develop'.
    
     Changes not staged for commit:
     (use "git add ..." to update what will be committed)
     (use "git checkout -- ..." to discard changes in working directory)
    
             modified:   .gitignore
    
     no changes added to commit (use "git add" and/or "git commit -a")
    
    
  • に追加します.
  • ブランチステータス
    git add .gitignore
    
    を再度確認すると、コミットされる緑の
    git status
    
  • が表示されます.
  • 先の修正のためにlogを追加して、testはlogの内容
    $ git status
    On branch develop
    Your branch is up to date with 'origin/develop'.
    
    Changes to be committed:
    (use "git reset HEAD ..." to unstage)
    
            modified:   .gitignore
    
    は以下の内容
    git commit -m "test"
    
  • を見ました
  • 現在のコミットをリモートdevelopブランチ
    [develop 2334660] test
    1 file changed, 2 insertions(+), 1 deletion(-)
    
    git push
  • にプッシュする.
  • このバグ修復を自分のリモートブランチに提出すると
  • が完了する.
    merge forkの元のブランチに変更
  • Gitページバージョンの自分のブランチに入り、Creat Merge Request
  • をクリックします.
  • 合入情報を記入し、具体的には以下の通りである[外鎖画像の転送に失敗した場合、ソース局は盗難防止チェーンメカニズムがある可能性があり、画像を保存して直接アップロードすることを提案する(img-92 uzlpa 3-1575370862722)(https://github.com/aoeivu/aoeivu.github.io/blob/master/posts/2019/12/03/7.jpg?raw=true)]
  • 前のステップChange Branchをクリックして次のインタフェースに入ります今回は自分のdevelopからforkブランチのdevelopにプッシュするので、次のように選択し、Compare branches and continue
  • をクリックします.
  • は自動的に第2ステップインタフェースに戻るのを待っていて、情報が間違っていないことを検査して、Submit merge requestをクリックして、Ownerに比較合併
  • を行うことを通知します.
    forkのリモートブランチには変更があり、最新のforkのリモートブランチを自分のローカルとリモートに同期します.
  • リモートウェアハウスをローカルremoteブランチ
  • に追加
    git push origin develop
    
  • 現在の倉庫のリモートブランチ
  • を表示する
    git remote add upstream [email protected]:5G-SDX55/Standard.git
    
  • fetchリモートブランチ(最新のリモートブランチをローカルブランチに更新)
  • $ git remote -v
    origin  [email protected]:Flynn.Chen/Standard.git (fetch)
    origin  [email protected]:Flynn.Chen/Standard.git (push)
    upstream        [email protected]:5G-SDX55/Standard.git (fetch)
    upstream        [email protected]:5G-SDX55/Standard.git (push)
    
  • 結合fetchブランチを自己masterまたはdev
  • に分岐する
    $ git fetch upstream
    remote: Enumerating objects: 129, done.
    remote: Counting objects: 100% (116/116), done.
    remote: Compressing objects: 100% (46/46), done.
    remote: Total 79 (delta 39), reused 62 (delta 22)
    Unpacking objects: 100% (79/79), done.
    From 192.168.10.95:5G-SDX55/Standard
     * [new branch]      develop        -> upstream/develop
     * [new branch]      master         -> upstream/master
     * [new tag]         20191101_B1.01 -> 20191101_B1.01
    
  • は、自分のリモートウェアハウス
  • にプッシュする.
    git merge upstream/develop