Side note: the merging of octopuses and the scenarios of the branching axis of an octopus are very different. Remember that pointers in a DAG (directional acyclic graph) capture a point from a child (newer) to a parent or parents. Therefore, in the case of the merger of octopuses, you have a commit (commit object), which has more than two parents; in the case of an “octopus branch point” you just have a few commits pointing to the same thing as its parent.
octopus merge:
1 <---- M 2 <----/ | 3 <------|
Octopus branch point:
P <----- 1 ^-------- 2 ^-------- 3
So, I think the naming of this question is simply wrong
Answer
Now, if you want to separate modifications in your workspace between different branches in order to put each function in a separate topic branch, you can use an explicit intermediate area (aka index) in Git.
Suppose you have changed two files: “a” and “b,” and you want to change the file “a” to go to branch “A”, and change in the file “b” to go to branch “B”, suppose that the branch you are currently in is the branch point that you want to create at the base of the many branches you want to create, called "master".
First let's create a branch "A"
$ git checkout -b A master
Git answers:
M a M b Switched to a new branch "A"
"M" means that the files "a" and "b" change relative to the point where you based the branch "A" (branch "master"). (Below, I simply put the git answer below the command line call, and not separately mentioning the answer.)
Add the contents of the file 'a' to the intermediate region (index).
$ git add a
Note that if you want to add only a subset of the changes in the 'a' file to the 'A' branch, you can use "git add -interactive" (abbreviated "-i") or "git gui" to make changes to intermediate region and other similar manipulations.
Now we commit the changes to branch "A"
$ git commit Created commit 35d0061: Commit description... 1 files changed, 1 insertions(+), 0 deletions(-)
Note that we did not use the -a option for git -commit!
By the way, if you want to test the changes before leaving the staging area, you can use "git stash save --keep-index" to get the workspace in the state that you have to commit using "git commit", check the changes, then go back to the previous state using "git stash pop-index" (or "git stash pop", I don’t remember which one you need here).
Now we create another branch, branch "B", based on the branch "master"
$ git checkout -b B master M b Switched to a new branch "B"
You can easily see that the changes that you left for branch "B" (changes that you did not commit to branch "A") relate to the newly created branch "B". No need to delete files or delete changes. You do not need to know what is in other industries. Everything is automatic.
Once again, add the contents of the file 'b' to the intermediate area (index) and commit to branch 'B':
$ git add B $ git commit
You can repeat this as often as possible, and it does not get complicated with the new branch.
NTN