git-rewrite-history

How to amend older Git commit? [duplicate]

♀尐吖头ヾ 提交于 2019-11-28 15:00:40
This question already has an answer here: How to modify a specified commit? 15 answers I have made 3 git commits, but have not been pushed. How can I amend the older one (ddc6859af44) and (47175e84c) which is not the most recent one? $git log commit f4074f289b8a49250b15a4f25ca4b46017454781 Date: Tue Jan 10 10:57:27 2012 -0800 commit ddc6859af448b8fd2e86dd0437c47b6014380a7f Date: Mon Jan 9 16:29:30 2012 -0800 commit 47175e84c2cb7e47520f7dde824718eae3624550 Date: Mon Jan 9 13:13:22 2012 -0800 git rebase -i HEAD^^^ Now mark the ones you want to amend with edit or e (replace pick ). Now save and

Removing '.git' directory from git repo?

ε祈祈猫儿з 提交于 2019-11-28 10:46:15
I'm trying to migrate a git repo from Kiln to Github. I can add the new remote just fine, but when I try to push master to the new remote, I get the following error: Counting objects: 8691, done. Delta compression using up to 8 threads. Compressing objects: 100% (3000/3000), done. remote: error: object a9ee490ac00987835de30bdbc851da5e8d45d28b:contains '.git' remote: fatal: Error in object error: pack-objects died of signal 13 error: failed to push some refs to 'git@github.com:Account/repo.git' Commit a9ee490ac00987835de30bdbc851da5e8d45d28b has the following files in it: .git/ CHANGELOG.md

Remove intermediate commit in Visual Studio Online

感情迁移 提交于 2019-11-28 05:29:50
问题 I edited my README.md multiple times because I didn't see the preview button. Now my commit history is full of useless commits. Can I remove some of them, or at least hide them ? 回答1: CAUTION History rewriting can get your source control system in a pretty messed up state. Make sure you have a good backup of your sources in case anything goes wrong. Git Depending on your Team Project setup, the Readme.md is stored in a Git repository you can absolutely rewrite history and force push the

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-28 03:43:24
问题 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:

Purging file from Git repo failed, unable to create new backup

折月煮酒 提交于 2019-11-28 03:03:12
I tried to remove a file from my remote repo by running: git filter-branch --index-filter 'git rm --cached --ignore-unmatch Rakefile' HEAD But Git complains that Cannot create new backup. A previous backup already exists in refs/original/ Force overwriting the backup with -f rm: cannot remove /.git-rewrite/backup-refs : Permission denied rm: cannot remove directory /.git-rewrite : Directory not empty This was after I already deleted the .git-rewrite directory on Windows. How can I remove that file? It's a 29Mb file sitting on my repo, so I quite need to remove the file. I tried to delete the

How can I resume a git history rewrite?

[亡魂溺海] 提交于 2019-11-28 00:51:12
问题 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

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

好久不见. 提交于 2019-11-27 21:13:22
问题 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? 回答1: I have a script (github gist here

git, filter-branch on all branches

邮差的信 提交于 2019-11-27 17:41:37
I'm using the following sources to expunge some large files and directories from my repository: http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ Why is my git repository so big? git filter-branch only seems to work on the current branch - is there a way to apply it to all branches at once? Ben Lee The solution is simple: git filter-branch [options] -- --all Note the four dashes (two sets of double dashes with a space in between) in -- --all . If you look at the docs for git-filter-branch , it says this: git filter-branch [--env-filter <command>] [--tree-filter

remove filenames from specific path?

浪子不回头ぞ 提交于 2019-11-27 16:08:49
问题 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

Update a development team with rewritten Git repo history, removing big files

夙愿已清 提交于 2019-11-27 07:14:30
I have a git repo with some very large binaries in it. I no longer need them, and I don't care about being able to checkout the files from earlier commits. So, to reduce the repo size, I want to delete the binaries from the history altogether. After a web search, I concluded that my best (only?) option is to use git-filter-branch : git filter-branch --index-filter 'git rm --cached --ignore-unmatch big_1.zip big_2.zip etc.zip' HEAD Does this seem like a good approach so far? Assuming the answer is yes, I have another problem to contend with. The git manual has this warning : WARNING! The