開発では最終的にmasterブランチにマージする。
現在のブランチは以下の通り
terminal
/Users/sf213471118/git/test
$ git branch
* master
practice
現在、それぞれのブランチには以下のものが格納されている
Branch | File1 | File2 |
---|---|---|
master | README.md | - |
practice | README.md | div.md |
これを以下のようにしたい
Branch | File1 | File2 |
---|---|---|
master | README.md | div.md |
マージする際には
$ git merge <Subject file>
とするだけでマージされる。あとはadd
してcommit
すれば完了。
実際にやってみる。
terminal
/Users/sf213471118/git/test
$ git checkout master /* masterブランチに移動 */
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
$ git branch /* 移動確認 */
* master
practice
$ git merge practice /* masterにマージ */
Updating 0226a43..c44954c
Fast-forward
div.md | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 div.md
$ ls /* masterブランチの中を確認 */
README.md div.md
あとはadd
してcommit
してpush
して終わり
terminal
/Users/sf213471118/git/test
$ git add -A /* add */
$ git commit -m "merge from practice" /* commit */
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
$ git push origin master /* push */
Total 0 (delta 0), reused 0 (delta 0)
remote: detect-secrets-stream (beta) ver=252-281d7c3a32923b0277f57f164c55764676echrud FAQ: xxxx
remote:
remote: Successfully send push metadata.
remote: Push info collect pre-receive hook finished within 3 seconds.
To xxxx:sf213471118/test.git
0326b84..c43955a master -> master
GitHub上で確認して完了