
userUSERnoMacBook-Pro tutorial % git branch feature-AuserUSERnoMacBook-Pro tutorial % git branch feature-A* mainuserUSERnoMacBook-Pro tutorial % git checkout feature-ASwitched to branch 'feature-A'userUSERnoMacBook-Pro tutorial % git branch* feature-A mainuserUSERnoMacBook-Pro tutorial % git checkout mainSwitched to branch 'main'Your branch is ahead of 'origin/main' by 6 commits. (use "git push" to publish your local commits)userUSERnoMacBook-Pro tutorial % git branch feature-A* mainuserUSERnoMacBook-Pro tutorial % git checkout feature-ASwitched to branch 'feature-A'userUSERnoMacBook-Pro tutorial % git branch* feature-A mainuserUSERnoMacBook-Pro tutorial % git add a.jsuserUSERnoMacBook-Pro tutorial % git diff HEADdiff --git a/git_basics/tutorial/a.js b/git_basics/tutorial/a.jsindex ae17ca4..5599dae 100644--- a/git_basics/tutorial/a.js+++ b/git_basics/tutorial/a.js -2,3 +2,4 console.log('A is edited'); console.log('ほげほげ'); console.log('まみまみ'); console.log('ぷーぷー');+console.log('feature-A');userUSERnoMacBook-Pro tutorial % git commit -m "update to feature-A"[feature-A 50a5899] update to feature-A 1 file changed, 1 insertion(+)userUSERnoMacBook-Pro tutorial % git checkout mainSwitched to branch 'main'Your branch is ahead of 'origin/main' by 6 commits. (use "git push" to publish your local commits)userUSERnoMacBook-Pro tutorial % git branch feature-A* mainuserUSERnoMacBook-Pro tutorial % git checkout feature-ASwitched to branch 'feature-A'userUSERnoMacBook-Pro tutorial % git checkout main Switched to branch 'main'Your branch is ahead of 'origin/main' by 6 commits. (use "git push" to publish your local commits)userUSERnoMacBook-Pro tutorial % git checkout -Switched to branch 'feature-A'userUSERnoMacBook-Pro tutorial % git checkout feature-AAlready on 'feature-A'userUSERnoMacBook-Pro tutorial %
git branch feature-A branchのfeature-Aを作成する
git branch 今どんなbranchがあるのか、どこにいるのか表示する
git checkout main チェックアウトと言ってもどっちかといえばチェックイン。mainに移動
git checkout - 直前のブランチに移動
feature-Aブランチを main ブランチにmergeした

git checkout main まずくっつけて残したい幹の方に移動
Switched to branch ‘main’
Your branch is ahead of ‘origin/main’ by 6 commits.
(use “git push” to publish your local commits)
user@USERnoMacBook-Pro tutorial % git merge –no-ff feature-A –no-ffで履歴を残しながらマージ
user@USERnoMacBook-Pro tutorial % git config –global core.editor “vim” 編集ソフトをvimになってなかったからvimに設定
user@USERnoMacBook-Pro tutorial % git commit さっきエラーになったところから再度commit
[main 99c6b28] Merge branch ‘feature-A’
user@USERnoMacBook-Pro tutorial %
branchをつくってはmergeの練習

git branch bull //ブルブランチをつくる
git branch //ブランチ一覧と今どのブランチか確認
git checkout bull //bullブランチに移動
b.js ファイルを編集し保存し
git add b.js //b.jsファイルをステージに上げる
git commit -m “ブランチbullにコンソールログ追加” //コミットする
git checkout main //mainブランチに移動
git merge –no-ff bull //bullをmainにマージする。ff早送りしない→エディターが立ち上がる。そのまま:wq
: はコマンド開始
w は保存(write)
q は終了(quit)
を入力してコミット履歴を残す
git log –graph コマンド

conflictを解決する

コメントを残す