Here is my current commits.
commit1 - commit 2 - commit3 - commit4 - cmmit5 (my-app branch)
I checked out commit1
and made changes
git checkout <commi1's SHA>
// made some changes
git add . && git commit -m "commit prime 1"
// made other changes
git add . && git commit -m "commit prime 2"
Now, I want to merge(?) or rebase(?) on the top of my-app
branch.
I don't care about commit 5, I just want to put my currently changed commit1
to the top of my-app branch (not merging but overriding!). So the output will be below
commit1 - commit 2 - commit3 - commit4 - cmmit5 - commit prime 1 - commit prime2" (my-app branch)
- I don't think I need to "merge"
commit 5
andcommit prime 2
. - Maybe should I use rebase?
Here is my current terminal prompt:
jbaaa at jo's computer ~/directory on (HEAD detached from 8a36f955fc)*
git status output:
HEAD detached from 8a36f955fc
nothing to commit, working tree clean.
Suppose commit5 is
'12345'
''
''
commit1 is
'1'
''
''
commit prime2 is
'1'
'prime1 and prime2'
Final result must be
'1'
'prime1 and prime2'
If we merge
, we're getting this result instead. How do we avoid it?
'12345'
'prime1 and prime2'