Questions tagged [git-filter-branch]

git filter-branch is a native Git tool used to extensively rewrite branches, and is often used to remove unwanted large or secret files from Git repository history.

Filter by
Sorted by
Tagged with
0 votes
0 answers
28 views

Undo changes to the main branch

I made changes to the main branch like pushing the changes to another branch and just resetting the main branch to default try:git reset --hard origin/main but it resets all the ramifications, does ...
Raf4Killer's user avatar
-1 votes
1 answer
49 views

How to add a new initial version of a tracked file in a separate commit?

NOTE: I have solved my question before publishing it. I have since written a guide for myself. As the question and the answer were already written and I didn't find any post on SO dealing with this ...
adamency's user avatar
  • 891
2 votes
1 answer
35 views

Edit author/committer of multiple commits based on commit message

I am looking to edit the author/committer of several commits whose message is prefixed with [TEST]. I know that you can edit the authors with environment variables but I can't find it by searching ...
A-d-r-i's user avatar
  • 97
0 votes
0 answers
18 views

Git: Change authors through history [duplicate]

I work on a shared lab system with another person on a project. We have both been working on a project so we use the same user on the machine, but we are testing different parts of a code so we each ...
Mridul Gupta's user avatar
0 votes
1 answer
63 views

How to delete old/historic Git objects which are no longer in HEAD?

I have a Git repository with nearly 300k commits of over two decades. This repository is the result of a migration from SVN to Git, so I'm free to rewrite history. It has a single branch only and no ...
Eti's user avatar
  • 257
0 votes
0 answers
32 views

How can I download the list of all the branches which are in cloud bitbucket repository?

Our repo size is more and we want to delete unwanted branches. For that I want to make a list of all branches im a particular repo. But no where I am seeing any such option. Please guide. Regards, In ...
VENKi's user avatar
  • 1
1 vote
1 answer
70 views

How can one change the timestamp of an old commit in Git (Git filter-repo)?

In this question someone answers with a git filter-branch command in this post. But, I would like to know what the equivalent is in git filter-repo as git filter-branch is the old and slow command and ...
Anston Sorensen's user avatar
0 votes
1 answer
31 views

Why changed history (by filter-branch) get reverted when using fetch

I am using Github and trying to change the committer, author and email of old commits for a user, I used .sh file to change the history: #!/bin/sh git filter-branch -f --env-filter 'if [ "$...
Msh's user avatar
  • 59
0 votes
0 answers
31 views

git filter-branch messed up my contribution graph (green squares on GitHub)

After running "git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch .idea' --prune-empty --tag-name-filter cat -- --all ", my contribution graph on my profile got ...
Anjaehyun's user avatar
1 vote
0 answers
107 views

How can I remove a Git submodule from all history?

In my project I need to remove link to the submodule from all history of the project. If it was a simple file than that could've been done with git-filter-repo. If it was just removing submodule than ...
Dmitrii Motorygin's user avatar
0 votes
1 answer
54 views

Truncate and migrate git repo

We are migrating from Azure DevOps Git to GitHub. The repo is huge, old, unfortunately has binaries and with tons of branches and tags. We decided on a cut-off date and want to drop all history before ...
Mickey Cohen's user avatar
  • 1,057
-1 votes
1 answer
349 views

How can I move changes to a file from one commit to another?

How can I directly edit git history as to "drag 'n drop" changes from one commit to another? Within a branch I have three commits: A--B--C The contents of which are: A -- add file_a B -- ...
Drewzillawood's user avatar
1 vote
0 answers
58 views

git filter-branch clear notebook outputs all branches

I have been working out of jupyter notebooks for a while and never bothered to erase all notebook cells before commiting to my git repo. Those notebooks are full of embedded graphs/html/images/logs ...
tiludeepmed's user avatar
-1 votes
1 answer
48 views

ensuring a cancelled git filter-branch does not change any file in repo

I recently ran the command git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch utils.js" in a feature branch with the aim of removing a file from my git repo/history (I ...
Sabo Boz's user avatar
  • 1,975
-1 votes
1 answer
61 views

How to clean git history without pushing to master

I have a very basic knowledge of git Looking to remove files from git history, team has been pushing large .CSV to the repo for months (because the extension was in caps they went through the ....
Adav's user avatar
  • 428
0 votes
0 answers
194 views

How can I create a Git workflow that listens for changes in a specific directory and displays select branches in a dropdown?

so I am new to git action workflow and got my first task which is a workflow_dispatch which listen to a code changes in some directory (source/team_a). I want to be able to display only the relevant ...
teslaTanch's user avatar
0 votes
1 answer
63 views

Remove git history of big file after file was deleted

Someone recently created a new branch on my repository, and uploaded a big file (5GB). As a result, no one could pull the repository anymore, since it became to big (pulling works on Mac, but not on ...
Ruben_8_24's user avatar
0 votes
0 answers
144 views

Delete file in history by filter-branch but still can show

And: I want to delete some garbarge large file from git repository, Then Long to short Why file that deleted still show in git rev-list --all --objects and can be show git show xxxxxx Full version: ...
Alceatraz's user avatar
  • 420
-1 votes
2 answers
170 views

using sed in git filter-branch to replace path in xml files

I am trying to replace path using sed in git filter-branch command. I have three similar files DOM.xml in 3 different folders. example: SAM20/sam/DOM.xml SAM21/sam/DOM.xml SAM22/sam/DOM.xml Content ...
SampathKumar Esikala's user avatar
4 votes
1 answer
455 views

How to use git filter-repo to format all code in git history

I would like to use git filter-repo to format all my c++ files in my repos history. To format the files I use clang-format. Doing this with git filter-branch I know that I could do: git filter-branch -...
the.polo's user avatar
  • 367
1 vote
3 answers
362 views

Git filter-branch or filter-repo to update submodule gitlink?

I have git repository A that uses B as a submodule. B's history has been rewritten after an LFS migration, but I would love it if A could still have its entire history functional. After the LFS ...
Bibzball's user avatar
  • 303
0 votes
0 answers
150 views

How do I change the author and author email for multiple commits?

This was a problem I wanted to solve. When I searched up this question, I saw answers using git filter-branch and git filter-repo. I can say with 100% confidence that git filter-branch is too slow and ...
Dennis's user avatar
  • 1
1 vote
0 answers
733 views

How to use `git-filter-repo` to change author's and committer's date, e-mail and name of a specific commit or SHA1 message?

I wanted to use git filter-branch to rewrite each commit or SHA1 message history with a different author and committer's date, e-mail, and name, but I've been warned against this usage and encouraged ...
Oo'-'s user avatar
  • 223
1 vote
0 answers
105 views

Is it possible to remove/ignore Pull request merges during git filter-repo? How do it do it?

I am trying to move a folder from RepoA into RepoB with git and file histories. Using git filter-repo for the purpose as below git filter-repo --path src/test However doing so includes all the Pull ...
Britto's user avatar
  • 501
0 votes
1 answer
195 views

How to work only on a directory of a repo

I'd like to work on features of an app available in a public GitHub repo. This repo contains the installation files and a directory (call it local) in which are the local files that are indeed ...
matmicha's user avatar
0 votes
1 answer
3k views

How to delete all files > 1 Mb from the history (but keep them in the repository) [duplicate]

I have a repository with many big files (psd, exe, pdf, etc.) and every time I commit an update of those files, the git .pack file grow drastically to keep the history. How can I delete all files > ...
zeus's user avatar
  • 12.3k
1 vote
0 answers
302 views

! [remote rejected] after deleteing big blob

I wish to remove an old big blob from my repo history so I did the following: git clone --mirror [email protected]:$USER/my-repo cd my-repo.git java -jar $HOME/bin/bfg-1.14.0.jar --delete-files big-file....
lrkwz's user avatar
  • 6,175
1 vote
2 answers
2k views

How to remove files from a folder in .gitignore?

It seems like I have an issue where a folder "Resources/" was added to .gitignore on our development branch, while another developer mistakenly committed files to this folder in a feature ...
Adam Ryason's user avatar
1 vote
1 answer
3k views

How to exclude certain branches for a path pattern within Github Actions?

How to apply branches-ignore and paths-ignore on GitHub Actions? For example, if I have the following source tree: |-src\ |----reports\ |-------<foo>DailyReports.ts I want to only deploy that ...
Kok How Teh's user avatar
  • 3,429
3 votes
1 answer
277 views

Git - Rewrite all affected commits user email - not working for activity

I've committed a bunch of commits to many repositories on Gitlab over two years. However I realized I hadn't set up the proper email. I used git filter-branch to filter the history and change the user ...
David Strauch's user avatar
1 vote
2 answers
321 views

How can I diff a repo before and after filter branch?

Git has an advanced command called filter branch for making various complex changes to a repo's git history. I intend to use this to fix some accidental mistakes in my repo, but I'm not experienced ...
Wassinger's user avatar
  • 347
1 vote
1 answer
251 views

Git - How to remove a file from repository (devops) without cloning it locally

I've got this problem: A team member pushed a corrupted file to the repo on azure devops (on premise), we found the corrupted file because navigating the commits on devops, that one was impossible to ...
Alessandro's user avatar
4 votes
1 answer
4k views

Selectively move files & directories to new repo (preserving history)

I have a project with a structure like this: src/ scripts/ db/ other_stuff/ even_more_stuff/ file1 file2 file3 This repository needs to be split up. db and scripts need to be split out into their own ...
FrustratedWithFormsDesigner's user avatar
1 vote
1 answer
130 views

How to change author of specific commits based on a predicate

All answers I see regarding this question (here, here) only ever offer ways to either change the most recent commit(s) or all commits, however I want to change the author of only past commits that ...
Daniel Porteous's user avatar
0 votes
0 answers
228 views

git remove unwanted huge blob files

My git repository was huge in size, Hence on analyzing i found that there where couple of huge files accidentally checked-in in a branch and it was removed. But since git maintains its history. I had ...
Immanuel Fredrick's user avatar
1 vote
0 answers
220 views

Only keep tags of a Git history

Let’s say I have the following Git history: * (develop) commit I | * (master) [v1.1] commit H | * commit G | * [v1.0] commit F | * commit E | | * (feature-A) commit D |/ * [v0.1] commit C | * commit ...
Morgan Courbet's user avatar
0 votes
0 answers
323 views

Gitlab: can't force push after changing history (pre-receive hook declined)

I'm trying to remove a file from a projects commit history, I'm attempting this with the git filter-repo tool but I also got the same results when using git filter-branch, I'm able to successfully ...
StackOverMySoul's user avatar
2 votes
1 answer
780 views

git-filter-repo doesn't read my mailmap file

Continued to my previous question, I need to use git filter-repo in order to modify the Author name and Comitter name of some of the commits recorded in my repository's log .But I have some troubles ...
somia's user avatar
  • 193
1 vote
1 answer
2k views

Is it possible to use `git filter-repo` to remove a specific version of a file from a git repository?

Suppose I have a small Git repository with three commits: commit cccc: updated smile.png (LFS) updated manual.md commit bbbb: updated smile.png (LFS) <==== Don't want this specific ...
Donuts's user avatar
  • 37
16 votes
2 answers
8k views

How to modify remote history with git filter-repo?

In the past I've used git filter-branch to remove files from my git history. Following that, I can do a force push to update the remote repository. For example, removing all HTML files from the local ...
user174358's user avatar
0 votes
2 answers
915 views

Hide API keys from github public repo

I'm looking for a way to prevent api keys and such to wind up in a public repo. (where it's hosted don't actually matter) So I understand that the common solution is to add the file containing the api ...
Eric Driussi's user avatar
0 votes
1 answer
295 views

git init under python script called by git filter-branch uses wrong directory

I run the following MWE of python script to read throw commits and create another git projec somewhere else. I call this script this way to iterate through git projectA and create another git projectB ...
mercury's user avatar
  • 146
1 vote
1 answer
950 views

git filter-branch: Cannot rewrite branches: You have unstaged changes

I run this command git filter-branch -f --tree-filter "echo AAAAAAA" --prune-empty --tag-name-filter cat -- --all And get the following error Proceeding with filter-branch... Cannot ...
mercury's user avatar
  • 146
1 vote
1 answer
997 views

fatal: bad revision '$GIT_COMMIT''

I just want to see the content of GIT_COMMIT variable over each commit: git filter-branch --tree-filter 'echo $GIT_COMMIT' -- --all I get this error: WARNING: git-filter-branch has a glut of gotchas ...
mercury's user avatar
  • 146
-1 votes
1 answer
278 views

Deleting a file that contains some sensitive data from Git history

How can I delete appsettings.json file from Git history? I have applied this command in Git: $git filter-branch --index-filter 'git rm --cached --ignore-unmatch appsettings.json' HEAD But It does not ...
x19's user avatar
  • 8,387
2 votes
1 answer
380 views

Understand git-filter-branch usage with update-index

I've been trying to decipher the git-filter-branch command used here to rewrite the index such that all the repo contents are within a new directory, which is then used to move this to the ...
tangy's user avatar
  • 3,106
0 votes
1 answer
71 views

Split a repository based on commits instead of directory or file type

My git repository is getting to large, so I want to split it into one or more repositories. When searching for it I can find many solutions based on git-filter-branch, that will rewrite the whole ...
Bimme's user avatar
  • 127
0 votes
1 answer
28 views

./.git-rewrite files after unfinished git filter-branch attempt

i have 2 local (say A and B) and one remote repository. unfortunately i added a huge folder into A and pushed it. as i wanted to pull it into a third local repository C (my laptop), it was not ...
zuiop's user avatar
  • 31
0 votes
1 answer
186 views

Remove multiple duplicate git commits

Having run commands to change my author name on my repo I am now left with almost every single commit existing with both old and new author names. How do I remove all the duplicate commits so that ...
RobertEves92's user avatar
2 votes
1 answer
800 views

How to port commits from one Git branch to another, but without some files

I have a branch, testing, that contains tons of changes to files in a/, and also to files in b/. I want to port all of the commits from testing onto my master branch. However, I want to only port the ...
Domenic's user avatar
  • 111k

1
2 3 4 5
10