A local project is ready to be pushed to a GitHub repository. The GitHub repository was initialized WITHOUT README and license.
From commit C1
to Cn
- C1
is the first/initial commit, and Cn
is the n-th/latest commit -, the local project contains sensitive. But from the commit Cn+1
onwards the sensitive data is masked.
For example, C1..Cn+3
is my currently local git repository:
C1 < C2 < C3 < .. < Cn < Cn+1 < Cn+2 < Cn+3
I want to push the commit Cn+1
and onwards. So, the remote repository should have C1'..C3'
C1 < C2 < C3 < .. < Cn < Cn+1 < Cn+2 < Cn+3
C1' < C2' < C3'
Where C1'
in the remote repository is Cn+1
in my local repository.
How to add the local project to GitHub starting at the commit Cn+1
? The following push should ignore the commits C1..Cn
.
I've already tried git push origin <sha>:<branch>
but it push the whole project. Rebase didn't quite fit for me either.