why all previous commits got pushed again to the new branch?

69 views Asked by At

I pushed some commits to branch A, and create a new branch B, pushed some other commits to B, why commits which were pushed to A also got pushed to B?

I tried to make changes directly on GitHub, but once I use VSCode to push, all previous commits got pushed again.

1

There are 1 answers

2
shindetsu On

When you create your branch B, from your branch A, the commits you pushed before are already in the branch. If you wanted to create a separate branch without those commits, you must have checkout the commit before the branch A, and make a branch from this commit.