Skip to main content

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.

git-rewrite-history
Filter by
Sorted by
Tagged with
0 votes
0 answers
23 views

How to split SVN repo to multiple git repos with history of moved files

This is another story about the conversion of a Subversion repository into multiple git repositories. But the question is not about how to do that in general but instead, how to keep the history of ...
David's user avatar
  • 153
0 votes
1 answer
37 views

Remove original git history for specific remote repository, but keeping it else

For my current project my project partner requires to sync my code not only with my git-server based on gitlab, but also with his git-server (unknown base). However, I don't want to expose all history ...
arc_lupus's user avatar
  • 4,086
0 votes
2 answers
125 views

How to remove personal email from git commits after PR has been merged?

On GitHub I've successfully opened a PR on a public repository, which has been recently merged: My Pull Request (#25) * Feature 1 * Feature 2 * Bump version --------- Authored-by: My Username <my....
Nauel's user avatar
  • 485
0 votes
0 answers
89 views

How to use git filter-repo to rewrite history in a Gitlab repository that uses git LFS?

I have a private Gitlab repository that I want to make public, but some of the people who have worked on it don't want their names/Gitlab accounts to be visible there. I wanted to scrub their names, ...
Red's user avatar
  • 425
0 votes
1 answer
92 views

How to delete one commit completely from Github?

I have some orphaned commits accidentally committed to GitHub. Following this QA answer,I use git reflog expire --expire-unreachable=now --all to remove them from git rev-list --all. (I tried use git ...
An5Drama's user avatar
  • 365
0 votes
0 answers
41 views

How Can I Convert Tabs To Spaces Using Rebase?

A colleague accidentally committed a large number of changes with tabs instead of spaces. I want to rebase and amend that commit and change all the tabs to spaces. I don't want to change all the tabs ...
opticyclic's user avatar
  • 7,936
-1 votes
1 answer
70 views

Rewrite one line in one file in entire git history using git filter-repo

Just as the title says. Specifically, I want to change the value of a JSON file in the entire history of my git repo like { ... "FOO": "yes" ... } to { ... "FOO":...
geckels1's user avatar
  • 526
0 votes
0 answers
49 views

How to redirect from non eng to /eng/ in url path I am getting redirect loop (Right now in localhost but need both live and local)

Thank you for your time. I have done almost everything but I am stuck here in the redirect part Here is my full .htaccess code RewriteEngine on RewriteCond %{REQUEST_URI} !\.(css|js|jpg|jpeg|png|gif)$...
Aritra 's user avatar
0 votes
1 answer
56 views

How can I insert extra commits using git replace?

What I'm trying to do is add one or more extra commits in between two other historical commits. I could do this with git rebase however this only works in simple cases - it is completely unpractical ...
Chris Stryczynski's user avatar
1 vote
1 answer
313 views

How to "add" the history of a previous git repo to a new one?

So, I had this repo on a GitHub account, and also stored in local on the PC. At a certain point I deleted the account and made a new one. I created a blank repo on the new one, picked the local files ...
hammon5tl's user avatar
2 votes
0 answers
77 views

Amending commit messages with git rebase when there are merge conflicts

There are an enormous number of good web guides on how to amend old commit messages with git rebase. In my case this is essential as the hooks won't let me push remotely without changing the message. ...
Paul Epstein's user avatar
0 votes
0 answers
20 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
1 vote
2 answers
117 views

Rewrite history to remove all additions of lines matching a certain pattern

I have a range of commits in a C++ codebase. I added a particular include in a set of files that I want to undo for the whole range of commits. Is there any way of automatically going through the list ...
Alexander Torstling's user avatar
1 vote
2 answers
124 views

Putting unrelated histories behind each other

For some reason (due to complicated conversion from SVN) I have two Git repositories: git repo A contains all history up to 31st December 2021 git repo B contains all history from 1st January 2022 on ...
J Fabian Meier's user avatar
-1 votes
2 answers
98 views

Rewording a commit message in a Git repository with a non linear history

I need to change the message of a past commit. I tried the method described in How to reword a Git commit by its SHA1 hash?, viz. checking out the commit in question, amending its message and rebasing ...
Ivan dal Bosco's user avatar
0 votes
1 answer
59 views

Add a .gitignore file to every commit [duplicate]

I have a git repo that was converted from SVN. It lacks a .gitignore file. Of course, I could just add one and commit it on main, but it would be better if it were present also on other branches and ...
J Fabian Meier's user avatar
4 votes
2 answers
235 views

How do I format all commits in a branch?

I'd like to run an auto-formatting tool (e.g. Prettier, go fmt, clang-format, terraform fmt ...) on all commits in a branch. I could manually edit each commit in the branch using an interactive rebase ...
qff's user avatar
  • 5,754
1 vote
1 answer
64 views

Git rebase branch onto squash merge

I did a mess with my features branches. What I had: master: A - B \ branch1: E - F \ branch2: G - H And then I squashed and merge ...
Chana Drori's user avatar
2 votes
0 answers
313 views

How to remove the message about initializing Git LFS when cloning a repository?

A message about initializing Git LFS (see below) comes up when using GitHub Desktop to clone a repository that has previously used Git LFS. How can I remove this message? This repository uses Git LFS. ...
Joshua Shew's user avatar
1 vote
0 answers
49 views

Reduce github repository size by deleting commits

My github repository once had one commit with a very large executable inside, and some time later I realized this takes me (and other people) huge of time to clone it from anywhere, so I deleted this ...
SUSY's user avatar
  • 9
1 vote
3 answers
352 views

How to reapply Git tags after rewriting history using rebase?

I have a project where I'd started working on my old laptop and then continued on my new one. On my old laptop I had properly configured Git with user.name and user.email, but when I switched to my ...
Mig82's user avatar
  • 5,226
0 votes
1 answer
37 views

How can I locally preserve as much git history as I can when the reference repository won't?

I recently realised the reference repository that our team pushes to was not configured to reject non-fast-forward updates. Given the propensity of some team members to use history rewriting to clean ...
Pierre Lebeaupin's user avatar
2 votes
3 answers
203 views

How can I modify a git commit which is part of the master branch without breaking the branch history?

There is a commit on master branch which I need to make some changes to. Here's some history of what happened: I was working on some code, and merged this to master I created a new branch Someone ...
FreelanceConsultant's user avatar
-3 votes
1 answer
287 views

Change Commit Message Without Rebasing?

I have a relatively old branch (2 weeks). After changes, I commit my code (with the message git commit -m "ABC commit") and then pull the main branch. I resolved a few conflicts and merge by ...
Junaid S.'s user avatar
  • 2,632
1 vote
2 answers
158 views

Is there a way to have a commit per day and per file automatically in git?

I use git-auto-commit-mode (https://github.com/ryuslash/git-auto-commit-mode) in Emacs to preserve my files automatically sync with my repo. However, I got a massive list of commits per day (the ...
Maikol Solís's user avatar
0 votes
1 answer
106 views

Interleaving two Git repositories

How can I join two Git repositories by interleaving their commit history according to commit / author date? We can assume both repositories contain separate files. However, folder names might be ...
mdcq's user avatar
  • 1,860
2 votes
1 answer
421 views

On Gitlab, is there a commonly used procedure, similar to a Merge Request, for changes that rewrite the git history?

Something we could call a "Reset Request", because instead of requesting to merge the feature branch into master, we'd be requesting to reset master to the feature branch. The use-cases for ...
LoneCodeRanger's user avatar
3 votes
2 answers
774 views

How to recreate git commit history but with applying pre-commit hook?

I'm trying to rewrite git repository history and apply new pre-commit hook: Take every commit Apply pre-commit hook Keep the original metadata (author, date, message) Resolve conflicts manually, if ...
Dennis Golomazov's user avatar
1 vote
3 answers
126 views

Rewrite a file in an earlier commit then propagate that change to all later commits seamlessly

Suppose I have a series of commits like this. (0) Initial commit (1) Version 1 (2) Version 2 I already know that I can rewrite history without creating a new commit by using git rebase to edit, say, ...
naiveai's user avatar
  • 763
0 votes
0 answers
103 views

Preservice git history while converting VB to C#

I've used fishcodelib's Convert .Net library to convert a VB-project to C#. It creates C#-files next to the vb ones. I've deleted the vb-ones and checked everything in. I've got everything working, ...
realbart's user avatar
  • 3,845
-1 votes
1 answer
346 views

Git: How to remove intermediate commit? [duplicate]

Current Commit History O- commit C HEAD | O- commit B | O- commit A ← I want to delete this commit / / branch: feature/foo / 0 -- master HEAD Goal Commit History O- ...
DarkTrick's user avatar
  • 3,171
7 votes
2 answers
483 views

List all git commits that delete any file

Question How can I list all the commits that delete any file in the repo? (not a specific file, but all the commits that delete anything). Context We have a multiple-years-old repo and we plan to ...
Xavi Montero's user avatar
  • 10.3k
4 votes
2 answers
1k views

rewrite history to undo all changes to a file on current branch in git

Suppose I have a feature branch that modifies half a dozen files. Most of the commits on that branch involve file.py. I eventually realize that there's a potentially better way to implement this ...
Mark VY's user avatar
  • 1,597
1 vote
1 answer
2k 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 ...
arilwan's user avatar
  • 3,783
1 vote
1 answer
5k 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.6k
19 votes
2 answers
12k 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....
Synchro's user avatar
  • 37k
1 vote
0 answers
45 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 ...
Nixxen's user avatar
  • 87
1 vote
2 answers
556 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 ...
Keavon's user avatar
  • 7,293
0 votes
1 answer
235 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 ...
DrownedSuccess's user avatar
2 votes
1 answer
2k 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 ...
nTuply's user avatar
  • 1,364
1 vote
2 answers
735 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 ...
U. Windl's user avatar
  • 4,069
3 votes
1 answer
2k 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 ...
dotnetCarpenter's user avatar
0 votes
2 answers
890 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 ...
Developer006's user avatar
-1 votes
1 answer
285 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 ...
Ali Hasan Imam's user avatar
2 votes
2 answers
2k 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 ...
smnth90's user avatar
  • 798
0 votes
1 answer
115 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 ?
Yola's user avatar
  • 18.9k
0 votes
1 answer
602 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 ...
Jon Ericson's user avatar
  • 21.3k
1 vote
2 answers
604 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 ...
Ark-kun's user avatar
  • 6,661
0 votes
1 answer
189 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,...
Bipolarbear54's user avatar
0 votes
0 answers
37 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 ...
Thang Hoang's user avatar

1
2 3 4 5
7