Using git-subtree
, the number of diffs to calculate when running a git subtree split
increases over time, reaching values that can make a split take very long.
One way to fix that is to git rm
the path, commit it and then git subtree add
it back.
Is there a simpler/cleaner way of resetting a subtree?
If git revert is a “safe” way to undo changes, you can think of git reset as the dangerous method. There is a real risk of losing work with git reset . Git reset will never delete a commit, however, commits can become 'orphaned' which means there is no direct path from a ref to access them.
In simple words, git reset is a command to "fix-uncommited mistakes" and git revert is a command to "fix-commited mistake". It means if we have made some error in some change and commited and pushed the same to git repo, then git revert is the solution.
Adding a subtreeSpecify the prefix local directory into which you want to pull the subtree. Specify the remote repository URL [of the subtree being pulled in] Specify the remote branch [of the subtree being pulled in] Specify you want to squash all the remote repository's [the subtree's] logs.
git reset changes where the current branch is pointing to ( HEAD ). HEAD is a pointer or a reference to the last commit in the current branch. HEAD~3 would mean behind 3 commits from HEAD . Assuming HEAD is pointing to C3 and the index(stage) matches to C3 .
When doing the split the --rejoin
option can be used, which seems to exist exactly to reuse the splits that have already happened.
--rejoin::
This option is only valid for the split command.
After splitting, merge the newly created synthetic history back into your main project. That way, future splits can search only the part of history that has been added since the most recent --rejoin.
From https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With