git-filter-branch

Difference between git filter branch and git subtree?

邮差的信 提交于 2020-01-01 08:48:14
问题 Was searching throw SO for an answer to this. Came across this older thread which didn't seem to give any answers. Retriggering this thread hoping someone may know! Can someone tell me the difference b/w git subtree and git filter-branch? I'll use the same example in the original question for this: git subtree split --prefix=some_subdir -b some_branch git filter-branch --subdirectory-filter some_subdir some_branch 回答1: Yes, git subtree (a contrib shell) can be used to split repos, as

Difference between git filter branch and git subtree?

最后都变了- 提交于 2020-01-01 08:48:12
问题 Was searching throw SO for an answer to this. Came across this older thread which didn't seem to give any answers. Retriggering this thread hoping someone may know! Can someone tell me the difference b/w git subtree and git filter-branch? I'll use the same example in the original question for this: git subtree split --prefix=some_subdir -b some_branch git filter-branch --subdirectory-filter some_subdir some_branch 回答1: Yes, git subtree (a contrib shell) can be used to split repos, as

Can I rewrite an entire git repository's history to include something we forgot?

你说的曾经没有我的故事 提交于 2020-01-01 05:23:23
问题 We recently completed a conversion from Mercurial to Git, everything went smoothly, we were even able to get the transforms needed to make everything look / work relatively correctly in the repository. We added a .gitignore and got underway. However we're experiencing some extreme slowdowns as soon as we encorporate/work with any of our old feature branches. A little exploring and we found that since the .gitignore was only added to the develop branch when we look at other commits without

Running filter-branch over a range of commits

点点圈 提交于 2019-12-28 05:16:23
问题 git filter-branch --env-filter ' export GIT_AUTHOR_EMAIL="foo@example.com" export GIT_AUTHOR_NAME="foo"' -- commita..commitb Results in Which ref do you want to rewrite? So it seems that filter-branch doesn't allow you to use range notation use a range between two arbitrary refs. What is the most straight forward way of running a filter over a range of consecutive commits (somewhere within the history of a branch) if this approach isn't possible. 回答1: You cannot apply the filter-branch in the

Using Git filter-branch to rename author and committer of several branches including tags

こ雲淡風輕ζ 提交于 2019-12-25 06:27:36
问题 I need to update all my previous commits to reflect a change in my user-name. This needs to be done to all branches and also carry through all my tags. I'm the only committer and this is all done in my local repo only. Using numerous sources on here I arrived at the command git filter-branch --env-filter "GIT_AUTHOR_NAME='new_name'; GIT_COMMITTER_NAME='new_name';" --tag-name-filter cat -f -- --all which seemed to do the trick, but git log --all --graph shows that instead of overwriting I now

How to reword any commit's message given the following message format?

折月煮酒 提交于 2019-12-24 20:07:26
问题 I need to modify a commit's message given the commit id without changing any other commit info. However, the commit message should accept line breaks,etc similar to how it is done using the git commit command. For example, consider the following commit commit <id> Author: <user-name> <user-email.com> Date: ... Hello World I want to reword the commit message to this Hello World Text after line break1 More text The normal method would be to rebase interactively, and then edit the commit using

How to remove duplicated commits from filter-branch command on git?

狂风中的少年 提交于 2019-12-22 10:58:20
问题 I have a django project that I've kept private for a long period of time. Through the lifespan of the project I've had settings.py , base_settings.py , and secret_settings.py files with sensitive information. Now I've decided to make the code open source as I am no longer actively working on the project. I ran the commands below to remove the history of these files to make sure all sensitive information was gone. git filter-branch -f --tree-filter 'rm -f exchange/secret_settings.py' HEAD git

git filter-branch - discard the changes to a set of files in a range of commits

非 Y 不嫁゛ 提交于 2019-12-22 04:22:13
问题 Say I have a branch dev and I want to discard all the changes made to a set of files in the rage of commits in dev branch since it diverged from master . If a commit in this range only touches those files I'd liked it pruned. The closest I got was : git checkout dev git filter-branch --force --tree-filter 'git checkout master -- \ a/b/c.png \ ... ' --prune-empty -- master-dev-older-ancestor..HEAD but this has these drawbacks if the file was since deleted in master it will fail with error:

Git Subdirectory Filter with tags

百般思念 提交于 2019-12-21 21:36:39
问题 I am attempting to split a large repo into multiple smaller ones. The goal is to split a folder and retain the tags in the process. I have tried: git filter-branch --prune-empty --subdirectory-filter my-folder develop This correctly place my-folder at the root of the new project, and retained the tags. However checking out a tag resulted in seeing the entire old directory structure within the new repo. So I tried: git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter my

Remove a lot of files in git filter-branch

女生的网名这么多〃 提交于 2019-12-21 09:14:16
问题 I'm migrating a repository from svn to git. In this last step, I want to remove tons of files that aren't needed from the history. I'm trying the following command: git filter-branch --prune-empty --index-filter \ "for file in $(cat files); do git rm -rf --cached --ignore-unmatch ${file}; done" -f But it says that the argument list is too long. I could rewrite this like: for file in $(cat files); do git filter-branch --prune-empty --index-filter \ "git rm -rf --cached --ignore-unmatch ${file}