Add file to original commit without creating a new commit

I made 10 commits and each commit has already been moved to the central repository. Suppose I committed a commit, for example.

C1-C2-C3-C4-C5

where C5 was my last latch, and all the latches were pressed. I’m a branch master. I want to delete the history and want to keep the last commit in git logs. I don't want anyone to be able to reset reset to any previous commit or push.

someone told me to use git rebase -i head~4, but I want to be clear before introducing it.

I have the following commands

git checkout --orphan newB
git add -A
git commit
git branch -D master
git branch -m master
git push

and after these commands above my git graph becomes according to the given image below

git graph

The current graph of my repository is as follows

enter image description here

. . git rebase

$ git rebase -i head~5
fatal: Needed a single revision
invalid upstream head~5
+4
2

, upstream. ( , , - , , .)

--root, , , .

:

% git log --oneline
072c8fc Modification 3 to master
9bdb3a2 Modification 2 to master
45f0758 Modification 1 to master
96da320 Initial revision

upstream 96da320 ( HEAD~3) . , HEAD~4, , , , .

, --root:

% git rebase -i --root

rebase script :

pick 96da320 Initial revision
pick 45f0758 Modification 1 to master
pick 9bdb3a2 Modification 2 to master
pick 072c8fc Modification 3 to master
+3

git rebase -i head~5 git rebase -i head~4


rebase ?

, (, )


-i?

, ( vi)


~ 5


?

-

pick 9e40be3 First commit message
pick 6e20a2a Second commit message
pick 0b06199 Third commit message
pick 3b4d266 Fourth commit message
pick c273e2f Fifth commit message

# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit log message
# x, exec = run command (the rest of the line) using shell

c273e2f () - , .

, . , , fixup, squash (. ).

fixup "", , (, , , ).

squash , ( " ", ).

-

pick 9e40be3 First commit message
f 6e20a2a Second commit message
f 0b06199 Third commit message
f 3b4d266 Fourth commit message
pick c273e2f Fifth commit message

( - "" ), ,


, , -f , "" ( dev master),), , .

+1

All Articles