Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reset diff count in git subtree

Tags:

git

subtree

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?

like image 359
raphink Avatar asked Dec 27 '12 08:12

raphink


People also ask

Does git reset remove changes?

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.

How does git reset work?

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.

How do I use Subtrees in git?

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.

What does the command git reset hard head 3 do?

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 .


1 Answers

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

like image 187
Maic López Sáenz Avatar answered Oct 11 '22 08:10

Maic López Sáenz