git-filter-branch

Change the root commit parent to point to another commit (connecting two independent git repositories)

梦想与她 提交于 2020-07-05 11:24:24
问题 I have a project that has more than 3 years of history in the svn repository. It was migrated to git, but the guy who did this, just take the last version and throw out all these 3 years of history. Now the project has the last 3-4 months of history in one repository, and I've imported the other 3 years of svn history into a new git repository. Is there some way to connect the root commit of the second repository into the last commit of the first one? It is something like this: * 2017-04-21 -

Moving a file to different folder along with history in git

浪尽此生 提交于 2020-06-26 06:54:38
问题 First of all, I had a look at this question which is exactly the same what I am addressing here. But the problem is the solution given in the question, does not work for me. The solution given is this: git filter-branch --tree-filter "cd x; mkdir -p p/q; mv [files & sub-dirs] p/q" HEAD to move files & subdirs under x to x/p/q . This is exactly what I want. But this does not work when I tried. My directory structure is: mdwtest |-src | |-main | | |-java | | | |-a.txt | |-test | | |-java I

Remove history for everything except a list of files using git filter-branch

好久不见. 提交于 2020-05-23 07:11:08
问题 I'm trying to move some files between two git repositories repo1 and repo2 . I have a short list of files I'd like to move (preserving history). Three files to move from repo1 : libraryname/file1 libraryname/file2 tests/libraryname/file3 There are other files in libraryname/ and tests/libraryname/ . There are other folders in / and tests/ My plan is to checkout repo1 , then modify the history tree until it only contains history for the files I'm interested in. Then checkout repo2 , and merge

Remove history for everything except a list of files using git filter-branch

南楼画角 提交于 2020-05-23 07:11:06
问题 I'm trying to move some files between two git repositories repo1 and repo2 . I have a short list of files I'd like to move (preserving history). Three files to move from repo1 : libraryname/file1 libraryname/file2 tests/libraryname/file3 There are other files in libraryname/ and tests/libraryname/ . There are other folders in / and tests/ My plan is to checkout repo1 , then modify the history tree until it only contains history for the files I'm interested in. Then checkout repo2 , and merge

Change file name case using git filter-branch

a 夏天 提交于 2020-02-01 05:41:04
问题 I've got a git repo where some files differ in name by case only across branches. As a simplified example, in master, there's a file alpha/beta/foo.cpp and in branch bar , there's a file alpha/beta/Foo.cpp . The problem is that when I attempt to switch branches, git won't allow me to do it. There's an error that I don't have handy at the moment, but it basically looks like changes to file alpha/beta/Foo.cpp would be overwritten -- aborting even though a subsequent git status shows the working

Git repository size remains large on remote (Gitlab) after purging of large files with git filter-branch then git push --force

99封情书 提交于 2020-01-24 14:17:29
问题 I have followed the instructions on Gitlab's docs about "Reducing the repository size using Git " by purging of large files from history: https://docs.gitlab.com/ee/user/project/repository/reducing_the_repo_size_using_git.html The instructions, and I quote, are as follows: git checkout master git filter-branch --force --tree-filter 'rm -f path/to/big_file.mpg' HEAD git reflog expire --expire=now --all && git gc --prune=now --aggressive git push --force origin master I then deleted my local

Importing a Subversion repository with a non-standard layout into Git

南笙酒味 提交于 2020-01-23 10:13:31
问题 I'm trying to (permanently) migrate my group's Subversion repository to Git, but I'm running onto problems trying to clean up its non-standard directory structure. Some of the project's content is contained in trunk and branches folders, but not all of it. The project on Subversion is laid out like this: project/trunk/ project/branches/feature_1 project/branches/feature_2 project/libraries project/crontab ... After importing, I want the Git repository to be laid out like so: project/html #

Change email address in Git history

十年热恋 提交于 2020-01-12 16:07:12
问题 I have been working on a git repository for a while and made some commits. I have been using documentation blocks in my php files, including my private email address, like this: /** * Bla bla bla. * * @author: Nic <foo@bar.com> */ Now I have created a new email address and updated the documentation blocks, replacing the old address with the new one. But this change only applies to commits after the one where I changed the documentation. How can I completely remove the old email address from

Remove large commits from git

房东的猫 提交于 2020-01-12 07:14:07
问题 We're running a central git repository (gforge) that everyone pulls from and pushes to. Unfortunately, some inept co-workers have decided that pushing several 10-100Mb jar files into the repo was a good idea. As a consequence of this, our server we use a lot has run out of disk space. We only realised this when it was too late and most people had pulled the new huge repo. If the problem hadn't been pushed, then we could just do a rebase to snip out those huge commits and fix it, but now

git filter-branch that respects my initial commits .gitignore

狂风中的少年 提交于 2020-01-06 15:06:08
问题 I am trying to use git filter-branch and to let my intial commit consisting of a .gitignore (rebased into the branch afterwards) come into effect. This is what I run: git filter-branch -f --tree-filter 'git rm -r --cached . && git add .' --prune-empty This command however leaves the repository unchanged. Why? I also wonder why the following command does not remove all files in the repository: git filter-branch -f --tree-filter 'git rm -r --cached .' 回答1: A --tree-filter does not operate on