git-rewrite-history

Change git email for previous commits

最后都变了- 提交于 2019-11-30 12:51:56
So I read a lot about how to change previous commit's email address but for some reason mine is not updating. I did like 40 commits to my private repo with my local email (nameofMyComputer@kevin.local) which is bad since this email is not associated(and it can't be) with github. I then remembered that I needed to set the git.config before and so I did: git config user.email "newemail@example.com" and did a test commit and it worked perfectly. Is there a way I can revert all my previous commits to this new email? I read this question on SO Change the author and committer name and e-mail of

Git Merge Duplication after Ineffective BFG Use

别说谁变了你拦得住时间么 提交于 2019-11-30 07:26:22
I have somehow deeply borked by entire repository (used only by me) and could use some assistance in sorting it out. Here is what I did. I realized that in my commit history, there were some files containing credentials that I did not want just laying around. So, I decided to be legit and try to use the BFG Repo-Cleaner to fix these issues. I threw all the credentials in .gitignores, and moved on to trying to scrub them out of the history. As per the documentation instructions, I executed these commands: git clone --mirror myrepo.git java -jar bfg.jar --delete-files stuffthatshouldbedeleted

Amending the message of Git commit made before a merge

落花浮王杯 提交于 2019-11-30 04:38:35
I committed some test code before merging in a remote branch. This merge had a lot of conflicts and took some serious time to put right. So my history looks something like this: 7ab562c Merge from remote branch ... whole load of commits brought across from the remote branch... f3e71c2 Temporary TESTING COMMIT The test code is fine, I really just want to change the commit message. Normally I'd go right ahead with a git rebase -i f3e71c2^ (since none of this has been pushed yet), but I've been told by a colleague that this will mess up the merge. I really don't want to mess up the merge :) Is my

git: can't find blob - want to get rid of it from pack

我的梦境 提交于 2019-11-29 17:43:17
问题 I've a large blob that I want to get rid of! I thought I removed the file using this solution: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ (I've used -- --all instead of HEAD so that files are removed from all branches) rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune I've looked in the pack folder via this Why is my git repository so big? $ git verify-pack -v .git/objects/pack/pack-*.idx | sort -k3n ... last 4 lines:

How do I reduce the size of a bloated Git repo by non-interactively squashing all commits except for the most recent ones?

早过忘川 提交于 2019-11-29 10:14:40
My Git repo has hundreds of gigabytes of data, say, database backups, so I'm trying to remove old, outdated backups, because they're making everything larger and slower. So I naturally need something that's fast; the faster, the better. How do I squash (or just plain remove) all commits except for the most recent ones, and do so without having to manually squash each one in an interactive rebase ? Specifically, I don't want to have to use git rebase -i --root For example, I have these commits: A .. B .. C ... ... H .. I .. J .. K .. L What I want is this (squashing everything in between A and

How can I resume a git history rewrite?

喜欢而已 提交于 2019-11-29 07:14:07
I'm rewriting the history of a fairly big repo using git filter-branch --tree-filter and it's taking a few hours. I see that git is using a temporary directory to store its intermediate work as it goes along. Does that mean it's possible to resume a rewrite if it gets interrupted? If so, how? Edit The operation I'm doing is moving a couple of directories. These are currently in subdirectories, but I now need them to be in the root. e.g. dir1 - dir2 - dir3 - dir4 becomes dir1 - dir2 dir3 dir4 Of course my directory structure is a lot more complex than that, but that's the gist of what I'm

Amending the message of Git commit made before a merge

£可爱£侵袭症+ 提交于 2019-11-29 02:29:31
问题 I committed some test code before merging in a remote branch. This merge had a lot of conflicts and took some serious time to put right. So my history looks something like this: 7ab562c Merge from remote branch ... whole load of commits brought across from the remote branch... f3e71c2 Temporary TESTING COMMIT The test code is fine, I really just want to change the commit message. Normally I'd go right ahead with a git rebase -i f3e71c2^ (since none of this has been pushed yet), but I've been

remove filenames from specific path?

随声附和 提交于 2019-11-29 01:25:42
I've been playing around with the BFG Repo-Cleaner tool in order to clean up the history of a git repo by removing (temporary / large) files from several places in the directory hierarcy... i.e. /root/test/a.txt /root/test2/a.txt Now i'd like to remove all references of the 'test/a.txt' but keep the /test2/a.txt version.. Is there any way to cleanly remove that using BFG? (as mentioned on https://help.github.com/articles/remove-sensitive-data ) Since the repo has a fairly large history ( 10K commits ) BFG really is alot faster than the other methods i've seen so far... I'm the developer of The

How to remove old versions of media files from a git repository

£可爱£侵袭症+ 提交于 2019-11-28 23:05:08
I have a Git repository with several huge media files (images and audio files). Several versions of these media files have been successively commited to the repo. The files are successively refined versions of the same assets, and they have the same name. I want to keep only the latest version in the Git repository, because it is becoming too big. What is the simplest way to do this? How can I propagate these changes correctly to the upstream repository? I have a script ( github gist here ) to remove a selection of unwanted folders from the entire history of a git repo, or to delete all but

How can I combine Git repositories into a linear history?

老子叫甜甜 提交于 2019-11-28 21:27:19
I have two git repositories R1 and R2 , which contain commits from two periods of a product's development: 1995-1997 and 1999-2013. (I created them by converting existing RCS and CVS repositories into Git.) R1: A---B---C---D R2: K---L---M---N How can I combine the two repositories into a single one that contains an accurate view of the project's linear history? A---B---C---D---K---L---M---N Note that between R1 and R2 files have been added, deleted, and renamed. I tried creating an empty repository and then merging their contents onto it. git remote add R1 /vol/R1.git git fetch R1 git remote