-1

enter image description herethis is my Git remote repository from Github:

                                           origin/#2-ignore-pod-directory
                                          /
First commit - [origin/#1 add base project]

More detail, I want "First commit" and "origin/#1 add base project" to become "a single revision" instead of 2 revisions (like having the content of revision "origin/#1 add base project" become "the root revision of the project")

                              origin/#2-ignore-pod-directory
                            /
[origin/#1 add base project]

I am using a Macbook and Source Tree application. Please help me!

Trí Chồn
  • 617
  • 8
  • 15
  • When you say you want to remove A, what do you mean exactly? Is it a new repo? On A you are adding files, on B you are adding _other_files? Or you want A and B to become "a single revision" instead of 2 revisions (like having the content of revision B become "the root revision of the project") – eftshift0 Jun 04 '19 at 20:23
  • This link might help [https://stackoverflow.com/questions/3293531/how-to-permanently-remove-few-commits-from-remote-branch](https://stackoverflow.com/questions/3293531/how-to-permanently-remove-few-commits-from-remote-branch) – tan Jun 04 '19 at 20:32
  • @eftshift0 yes, I want A and B to become "a single revision" instead of 2 revisions (like having the content of revision B become "the root revision of the project") – Trí Chồn Jun 04 '19 at 20:36
  • Possible duplicate of [How can I merge two commits into one if I already started rebase?](https://stackoverflow.com/questions/2563632/how-can-i-merge-two-commits-into-one-if-i-already-started-rebase) – phd Jun 04 '19 at 21:32
  • https://stackoverflow.com/search?q=%5Bgit%5D+combine+two+commits – phd Jun 04 '19 at 21:32

1 Answers1

2

Based on comments:

git checkout B --detach # we go to B, disconnect from branch for the time being
git reset --soft HEAD~1 # set HEAD pointer to our parent revision, content remains the same, changes between B and its parent are on index ready to be committed
git commit -m "single revision that is the content of B"
# if you like how it looks like now, let's replay history between B and whatever branch is on top of it:
git cherry-pick B..some-branch
# at this point you should be able to set the pointer to the other branch on this revision
git branch -f some-branch HEAD
git checkout some-branch
eftshift0
  • 26,375
  • 3
  • 36
  • 60