Questions tagged [git-rewrite-history]
Rewriting the history of a Git repository, for example to edit old commits, remove unwanted data (e.g. private data or large files), rearrange file structure, fix commit metadata, etc.
305
questions
0
votes
1
answer
34
views
BFG Repo-Cleaner doesn't clean my gitlab repo
This is really worrying and stressful issue that I can't find any answer that works for me, so I cannot backup my code for over a year now (too bad!).
I am actually using BFG Repo-Cleaner to clean my ...
-1
votes
1
answer
40
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 everytime I commit an update of thoses files the git .pack file grow drastiquelly to keep the history. How can I delete all files > ...
1
vote
2
answers
187
views
Remove a file from git history using git-filter-repo on a fresh clone
I'm following this answer to remove a single file containing credentials from git history. I have git 2.35.1 and filter-repo 22826b5a68b6. The command I need is apparently:
git-filter-repo --path auth....
1
vote
0
answers
23
views
Can not push backup to GitHub due to too large files
I am aware that this issue has several related issues, but I have a slightly backward problem, where there already is a commit history to preserve.
I have a project repo I worked on last year together ...
0
votes
2
answers
75
views
Rewriting Git history to place all work in a subfolder instead of root
I have a simple repository with linear history where work was done in the root folder. I would like to rewrite history so that all the work from every commit looks like it happened in the /server ...
0
votes
1
answer
38
views
Combining the history of two git repositories
I have git repo A. I also have git repo B, which is taken at some commit of repo A, but with the .git folder deleted and remade with git init. Some commits have been made in B. I now want to combine A ...
1
vote
1
answer
89
views
How to undo a merge on a branch where there have been subsequent commits?
Let's say I have a develop branch where multiple people branch off of to work on either bugfixes or features.
Let's say now I have a branch called featureA that I worked on while some other person ...
1
vote
2
answers
116
views
(How) can I filter the commit log messages?
I extracted a new module from a git repository using git filter-branch ... (according the instructions I found in a book) repeatedly.
Basically I removed many unrelated files (i.e. "everything ...
3
votes
1
answer
260
views
Delete list of files with BFG-repo-cleaner
We are trying to shrink our git repository to under 500MB due to deployment issues.
To achieve that, we have created a new branch where we have moved all old images, videos and fonts to AWS S3.
I can ...
0
votes
0
answers
33
views
Can I delete a specif branch completely form history along with all LFS objects using "git filter-repo"?
I have a huge repo of size 10+ GB with multiple projects in it. The repo also has LFS objects in it. I want to do the following things:
Delete all the unused branches along with LFS objects (not just ...
0
votes
2
answers
98
views
git: Clean git history and keep only merged commits in master
In our git repo we have a policy to squash merge all the commits. Recently there was a policy update and some changes got merged with their local commits details into master. Is there a way I can ...
-1
votes
1
answer
80
views
How to remove old problematic git commits
Recently we found two old git commit from one of our ex team member, which is malicious and affected our entire repository. First commit deleted all files from repository and second commit added all ...
2
votes
2
answers
146
views
Git interactive rebase did not delete my other commits
I have some commits in my current branch. I want to convert those all commits into one commit and delete all those commits. So I have used the following commands
git rebase -i HEAD~9
Edited all ...
0
votes
0
answers
48
views
How to Delete MOST Instances of a File from a Git Repo?
*A variation on the oft-asked question of how to completely delete a file from a Git repo.
I have 300+ instances of a 3-year old file and would like to delete all but the last commits of the file from ...
0
votes
1
answer
64
views
Introduce a change in last n commits automatically
I have a bunch of commits:
T-1: commit-50
...
T-1: commit-1
Now I need to merge them under a new task. Is there a way to automatize turning them into
T-2: commit-50
...
T-2: commit-1
?
0
votes
1
answer
108
views
Is there a way to prevent dirty history being pushed to a repo?
I'm working with a repo that includes generated PDFs. Obviously this isn't a great idea, so we'd like to remove them from our repository history.1 I've tested out BFG Repo-Cleaner and the results are ...
1
vote
2
answers
168
views
Remove commit from history without changing anything else (dates, committers)
I expected this to be as easy as interactive rebase, but I've noticed that rebase changes commit dates and committers.
What would be the easiest way to remove a commit from history while leaving ...
0
votes
0
answers
67
views
How to delete commits from before a certain point?
At some point in the past, sensitive info was uploaded to a git repo. We removed this in the following commit and changed the info, but we'd still like to remove the original info from the git history,...
2
votes
2
answers
151
views
How i move all commits to another branch?
I am working on project alone (though some other people may use this repo) and for some time, I was making all my commits into master branch (commits are pushed to GitHub).
But at this point, I ...
0
votes
0
answers
30
views
Collect all changed files and commit after merged
I have master look like
|
|
abcd3 Commit3 (file A, B)
|
|
abcd2 Commit2 (file C, D)
|
|
abcd1 Commit1 (file E)
|
|
and in my feature branch
xyz1 MyCommit (file A, B)
|
|
abcd1 Commit1 ...
1
vote
1
answer
67
views
Storing results of BFG to new project in Gitlab
I've successfully (I think!) removed large files from a gitlab project mirrored on my local drive using BFG. I don't want to replace the existing gitlab project (for safety reasons), but instead want ...
1
vote
2
answers
259
views
Why can I still see the file after deleting it using BFG
This are the steps I did:
Created an empty folder.
Mirrored my repository using:
git clone --mirror git@bitbucket.org:somespace/myrepo.git
Got a list of 10 largest file using the following command:
...
1
vote
1
answer
60
views
How to work around force-pushing of an upstream branch?
I have a feature branch branchX that is using some-remote/base-branch as its upstream branch. I just discovered that some-remote/base-branch got its history rewritten by a force-push. What are the ...
0
votes
1
answer
165
views
Use git filter-repo to move a subdirectory to root while retaining files in root
I am attempting to split up a repository that contains a client and server into two repositories, and I want to move the respective folders to the root while also keeping the files I already had in ...
0
votes
0
answers
53
views
Retroactively set text files to binary with git
We have some files that go back a long ways that haven't been touched in a long while, and we realized the other day that they weren't marked as binary files.
Is there any way to rewrite our history ...
1
vote
1
answer
57
views
repair connection in git repo and merge with old repo to preserve history
PROBLEM
I have two code repositorys "REPO A" and "REPO B" which belong to the same project. In fact, REPO B is a continuation of REPO A and thus should include REPO A. I can not ...
1
vote
1
answer
47
views
How to add old project files midway to main branch
I have found 4 old versions of one file that I would like to add to a Git repository.
Initially, there is one single-ref main development line, as follows:
[ROOT] A - B - C - D - I - J - K - L - M [...
2
votes
0
answers
70
views
Removing or reset contributor from github.com?
I have done several commits with a wrong user, so I have renamed that commits with this script:
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="user2@example.com"
CORRECT_NAME="...
2
votes
1
answer
78
views
Automatic rebase to drop a commit that modifies a file?
I'm new to git rebase and doing something a bit wacky and stupid.
So let's say I have these commits which all modify the same file file.txt
a -> b -> c -> d -> e
I want to just remove ...
0
votes
1
answer
49
views
Split one branch into two in Git
I have a project with a completely linear history:
master A – B – C – D – E – F – G – H
I'd like to split it into two: develop with most of the commits, and master, into which develop merges only ...
0
votes
1
answer
45
views
Rebasing specific part of git history
Is it possible (with a rebase I guess) to get this
<lots of commit above>
* 54dda... commit d
* 78adf... commit c
* 65d3aa0 .. branch commit 3
* 404b9cf .. branch commit 2
* 77e8a38 .. branch ...
10
votes
1
answer
836
views
Make git `replace` commits permanent (or such)
I'm busy converting all my existing SVN repositories to Git, and at the same time also take the opportunity to use Git's ability to easily rewrite some history. For this I'm also using git filter-...
-2
votes
1
answer
113
views
Is it possible for github to remove my email adress from public repositories from a purely technical standpoint? [closed]
On GitHub, I contributed to Free/Libre & Open Source projects. Now, I want my email address from those commits to be removed.
I expect my user name to be in those commits, too. It does contain my ...
2
votes
1
answer
250
views
How to split out and rename code files in git while preserving history?
I am new to git and now facing a git repo 'housekeeping' challenge after deciding to clean up the code structure. There are two dimensions to my challenge:
Need to rename suboptimally titled REPO, ...
1
vote
1
answer
88
views
I can't remove Git Large File from repository history
I've a repository that was migrated from Mercurial to Git in the past, and this repository is on BitBucket.
Now I need to move from BitBucket to GitHub, but GitHub saying to me that exists a big file, ...
0
votes
0
answers
87
views
How to remove someone else's code from my commit after I pulled and rebased
I created a new branch from development branch and started writing code and pushing it to github. But after awhile the development branch was updated. So I needed to update the changes and rebase my ...
1
vote
2
answers
36
views
Split commit into existing commits
I have a branch with several commits:
A --- B --- C --- D
^
HEAD
I have finished to work on this branch and preparing the pull request. But I am not satisfied with ...
0
votes
0
answers
38
views
How to revert my git repository to the exact same state it was in disk, say, a month ago *without keeping secret new/recent content under the hood*?
I tried git reset --hard 0845f5de, pushed to a new repository in github, but everything appears the same in the github stats like, e.g. number of commits.
Where is this information stored?
None of ...
0
votes
3
answers
83
views
How to make two git branches (with common history) coherent with each other after rebasing one of them?
I think that my title is not clear enough, so I will describe the problem:
In my git project, I have 3 branches: master, b1, and b2. Here is the history tree:
A---B---C master
\
...
2
votes
1
answer
144
views
Git apply a change to all files in all previous commits
I would like to apply a change to all my files in my git history. More precisely, I would like to modify a specific line which is the author name (it is written in the header of all my files, I am not ...
1
vote
1
answer
36
views
Change git branch's root, retainig older commit as branch HEAD?
Forgive me if I've phrased it incorrectly, but what I have is master and master-variant where the latter is a variant of the generic product that I'm working on. It contains additional files and some ...
3
votes
2
answers
242
views
Can I squash a merge commit with one of its predecessors?
Let's say I start with a history like this:
A---B---C
\
\-D---E
Then, I merge the two branches, resolving some conflicts in the process:
A---B---C---F
\ /
\-D---E-/
But afterwards, I ...
1
vote
1
answer
438
views
BFG-repo-cleaner and pushing back to GitHub
I'm trying to follow the tutorial instructions here : https://rtyley.github.io/bfg-repo-cleaner/
I clone a new copy of my github based repo with --mirror
I follow the instructions for running bgf ...
1
vote
1
answer
517
views
Trying to reduce repo size with git filter repo
I am have a large repository that is now out of hand. So I am trying to delete old files, deleted files, binaries that I accidentally added to the history...
To this effect I am using git filter repo ...
-1
votes
2
answers
85
views
discarding commits after a successful merge, while keeping the code of the merge commit intact
There are two branches that branched from master : develop, and foo.
Both develop and foo diverged from master by several commits.
foo has been merged unto develop. Now foo and develop points to the ...
0
votes
0
answers
278
views
Why does my name appear twice in git commits?
So, I've been changing my email on git commits (to remove my main email from public view and use my secondary instead). I used this:
$ git filter-branch --env-filter '
NEW_NAME="New Name Value"
...
1
vote
0
answers
92
views
Remove cognito credentials from commit in the git history, Rewrite commit in master with password to remove
The commit has Cognito Pool ID, Cognito App Client ID. I want to remove just this cognito credentials from the commit in the git history. I don't want to remove that commit and after this commit there ...
2
votes
3
answers
808
views
Git: Bulk change of commit dates
When I need to change the commit dates of various commits, I use an interactive rebase and change them one by one.
How could I change them all in a single command ? In other words, I need to apply a ...
1
vote
1
answer
222
views
nulInCommit: NUL byte in the commit object body
I'm trying to export one of my projects from GitLab to GitHub using command line using these steps. [Migrate project by commandline] (https://help.github.com/en/github/importing-your-projects-to-...
1
vote
1
answer
154
views
Rewrite git history programatically
I would like to rewrite the history of one of my repo programatically, for example using gitpython.
The idea is to read a existing repository, and reapply each of its commits to a new one, after some ...