Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 78 characters in body
Source Link
mochadwi
  • 1.3k
  • 9
  • 37
  • 91

I already made a few changes on my commit and finalize my working copy, after that I did git push too.

But, suddenly I found a little problem on my modified files that has been already pushed to bitbucket repo. So, without undoing, I did manually changed my files into default for the first time. This is the workflow.

C1
README.md:
"This is the content of the first readme on README.md"

  1. git add README.md
  2. git commit -m 'initialize README.md'
  3. git push -u origin master
  4. DONE!

C2
after that, I updated my files into:
The content is new on README.md

  1. like above
  2. DONE!

C3 suddenly I made a few changes like these:
This is the content of the first readme on README.md add a few new lines add a few new lines

  1. git add README.md
  2. DONE!

I'm can't do commit on this state or I'll lose my C2 changes. In this case, I wanna git push my C3 and before I can continue my working copy, I wanna merge C2 and C3, but only the "changes". So, in this case, would be like these:
The content is new on README.md add a few new lines add a few new lines

The question why I did this, because I forgot to work on add a few lines first before modifying "the first line".

I don't think git revert would do magic. Thank you very much for your attention! :)

EDIT: git cherry-pick would also overwritten the local changes T___T

I already made a few changes on my commit and finalize my working copy, after that I did git push too.

But, suddenly I found a little problem on my modified files that has been already pushed to bitbucket repo. So, without undoing, I did manually changed my files into default for the first time. This is the workflow.

C1
README.md:
"This is the content of the first readme on README.md"

  1. git add README.md
  2. git commit -m 'initialize README.md'
  3. git push -u origin master
  4. DONE!

C2
after that, I updated my files into:
The content is new on README.md

  1. like above
  2. DONE!

C3 suddenly I made a few changes like these:
This is the content of the first readme on README.md add a few new lines add a few new lines

  1. git add README.md
  2. DONE!

I'm can't do commit on this state or I'll lose my C2 changes. In this case, I wanna git push my C3 and before I can continue my working copy, I wanna merge C2 and C3, but only the "changes". So, in this case, would be like these:
The content is new on README.md add a few new lines add a few new lines

The question why I did this, because I forgot to work on add a few lines first before modifying "the first line".

I don't think git revert would do magic. Thank you very much for your attention! :)

I already made a few changes on my commit and finalize my working copy, after that I did git push too.

But, suddenly I found a little problem on my modified files that has been already pushed to bitbucket repo. So, without undoing, I did manually changed my files into default for the first time. This is the workflow.

C1
README.md:
"This is the content of the first readme on README.md"

  1. git add README.md
  2. git commit -m 'initialize README.md'
  3. git push -u origin master
  4. DONE!

C2
after that, I updated my files into:
The content is new on README.md

  1. like above
  2. DONE!

C3 suddenly I made a few changes like these:
This is the content of the first readme on README.md add a few new lines add a few new lines

  1. git add README.md
  2. DONE!

I'm can't do commit on this state or I'll lose my C2 changes. In this case, I wanna git push my C3 and before I can continue my working copy, I wanna merge C2 and C3, but only the "changes". So, in this case, would be like these:
The content is new on README.md add a few new lines add a few new lines

The question why I did this, because I forgot to work on add a few lines first before modifying "the first line".

I don't think git revert would do magic. Thank you very much for your attention! :)

EDIT: git cherry-pick would also overwritten the local changes T___T

Source Link
mochadwi
  • 1.3k
  • 9
  • 37
  • 91

Merge 2 different commit

I already made a few changes on my commit and finalize my working copy, after that I did git push too.

But, suddenly I found a little problem on my modified files that has been already pushed to bitbucket repo. So, without undoing, I did manually changed my files into default for the first time. This is the workflow.

C1
README.md:
"This is the content of the first readme on README.md"

  1. git add README.md
  2. git commit -m 'initialize README.md'
  3. git push -u origin master
  4. DONE!

C2
after that, I updated my files into:
The content is new on README.md

  1. like above
  2. DONE!

C3 suddenly I made a few changes like these:
This is the content of the first readme on README.md add a few new lines add a few new lines

  1. git add README.md
  2. DONE!

I'm can't do commit on this state or I'll lose my C2 changes. In this case, I wanna git push my C3 and before I can continue my working copy, I wanna merge C2 and C3, but only the "changes". So, in this case, would be like these:
The content is new on README.md add a few new lines add a few new lines

The question why I did this, because I forgot to work on add a few lines first before modifying "the first line".

I don't think git revert would do magic. Thank you very much for your attention! :)