How to remove Git history of anything but current files
How can I remove the complete history of anything on any branch but the files currently existing on HEAD (my master branch)?
I have been doing things like
git filter-branch -f --prune-empty --index-filter \
"git rm -rf --cached --ignore-unmatch '*.js' '*.html' '*.css'" \
but this is getting tedious, since I have to make explicit what to remove, not what to keep.
Git in principle should be able to determine all ancestors of current files, go back in history, and remove everything thats not in the ancestors. How?
I gave up: this whole rewriting of history seems to be very brittle and messes up things. It sucks. I just copy over files and bite the bullet of loosing history.
What I'm doing: I'm working in Xcode, and started using Git not that long ago. As per normal, there are some files that I don't want to be included in the Git database, that are to do with Xcode sett
This question already has an answer here: Git conflict markers [duplicate] 1 answer Something weird happened this morning when I did a commit. I got an error, said to pull, I then pushed and al
I've got a git repo of 300 MB. My currently checked-out files weigh 2 MB, and the git repo weighs 298 MB. This is basically a code-only repo that should not weigh more than a few MB. Most likely, some
I am trying to write a sed script to convert LaTeX coded tables into tab delimited tables. To do this I need to convert & into \t and strip out anything that is preceded by \. This is what I have
The scenario I'm trying to remove some files from the entire history of a git repository. They all share a couple of common criteria: They have settings in the file name. They may also have various
I'm trying to split a subproject off of my git repository. However unlike in Detach subdirectory into separate Git repository I don't have it in it's own subdirectory (and moving it in and doing the a
This question already has an answer here: Remove sensitive files and their commits from Git history 4 answers Redaction in git 5 answers Suppose I found out that there are files that weren'
I have various projects that had files with SVN history in them. I recently moved those projects to a Mercurial repository so now that history within the file is useless. Is there a way to remove thos
I have checkout'ed svn repo through git, but not from the first svn commit. Now I would like to extend the history a little back into past. Is it possible?
TL;DR: Is there an effective way to push “from now on, only” to a git repository mirroring another, without losing the history on other mirrors of the same project? I have a project of a certain scale
My current git history looks like this: develop: A -- B -- C \ feature1: D -- E \ feature2: G -- H -- I But, I would prefer this, instead: feature2: G' -- H' -- I' / develop: A -- B -- C \ feature1:
I've started using git yesterday. I found out that I can remove files by using the command git rm. But isn't that very complicated? When I use SVN and I delete a file in my Windows Explorer, I just ha
I have a project that contains traces to another project of myself that I've used as a kind of a template project. Now I want to remove these traces entirely from the repository. Basically I want to c
I use Eclipse EGit plugin to work with git repository. (I even use it for local projects to track changes made by tools.) However I discovered problem that makes usage for team projects not so good: W
This question should be related to: How to get current branch name in Git? Get git current branch/tag name How to get the name of the current git branch into a variable in a shell script? How to prog
How to remove the recent document history in Excel Ribbon using VBA. I am using the code below, but it doesn't seems to work. Sub Button1_Click() For i = 1 To Application.RecentFiles.Count - 1 Appli
I'm using git with my latex files. I had few conflicts and because paragraphs are long, it's difficult to find what's the difference, so I'm curious how git compares files? Is there a way to turn on c
How to reset a remote and local GIT repository to remove all commits, and start fresh with the current Head as initial commit.
I have made a 'git commit' followed by a 'git push'. How can I revert that change on both local and remote repositories? $ git log commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8 Author: Michael Sil
Is there a way to remove from an index with a single command only those files that have been added with -N flag?
I use Git, but some of my colleagues are unable to move away from SVN right now. We want the integration between the two systems to be seamless -- all of our development has been in git so far, so we
If you forget to add something to .gitignore, for instance, test-output/ and you review your changes and see the files got into the staging area through a git add . adding test-output/ to .gitignore
How can I view history on a particular file (which may have been deleted already in the current trunk)? Also, what diff tool do you suggest for mac?
We have a dev team of 10 and our 7,000 commit history needs a little bit of maintenance. People have committed with the wrong credentials (making our author list rather gross), and I'd also like to ob
Possible Duplicate: How to move files from one git repo to another (not a clone), preserving history I followed the steps at How to move files from one git repo to another (not a clone), preserving
is it possible with Git's tools to move files into a new folder while modifying its full history, as if the files had been there from their first add? I came up on this after merging some repos togeth
git add *.c is supposed to add matching files only from the current directory, not from its subdirectories. I noticed that if no file matches the searched pattern in the current directory, git add *.c
I have a git project which contains some files copied from another git project. Now I want to convert those files into a git submodule. Can I do that without losing the history of the changes I alread
We have the code base using CVS for long time. And now we are considering to move to git. The sources can be moved to GIT, no problem. But I want to know, how the history or the changes in CVS can be
This is a follow up on some similar answered questions about git handling binary files and how git can't follow file history very well. So, git can't properly follow file history. Heck, even git log
In my ZSH prompt I want to be able to output the current history event number (%! or %h) -1 If current history event number is !256, I want to subtract it by one and output the result in my prompt (i.
For some reason, when I initially did a pull from the repository for a git project of mine, I got a ton of files in my working copy that have no discernible changes made to them, but keep showing up i
Is it possible to selectively remove items from Google Chrome browsing history? I have a website from my history that wants to be the default everytime I start a search with a specific letter, but I o
I was wondering if anybody has a more efficient, more intelligent way to do this. The looping construct requires every deleted files to be expunged from every commit by reading each commit. With many
In many StackOverflow questions about git (and in the git man pages themselves), history logs are rendered with ASCII like this A---B---C topic / D---E---F---G master While they are not a complete h
How can I find files from the current directory which have been created/modified e.g. yesterday? Or day before yesterday, or eg. 20131010?
How can I remove those annoying Mac OS X .DS_Store files from a Git repository?
I removed 777 files which were in Git's branch newFeature by rm !(example) I would like to commit. Git ask me to manually remove each of the removed files by git rm file It would take a lot of time
My workflow goes like this: Create a new branch X. Do some commits Checkout to master Merge X into master But then my history looks like this: commit c37c0b495e6cede93dd359201e14af46f7d4bbaf Merge:
We have been using SVN and slowly the developers have been migrating to git-svn. Now we're ready to make the plunge and completely move to git (using gitolite). I am not sure how to migrate our reposi
Lets say that I have a git repo that looks like this. foo/ .git/ A/ ... big tree here B/ ... big tree here Is there a way to ask git log to show only the log messages for a specific directory. For ex
Say I introduced <feature.c> a while ago and now notice it shouldn't have been part of my main branch but rather a branch feature. Is it possible to use e.g. git-filter-branch to automatically m
I am writing some jazzy code which needs to determine the current branch name programatically. I don't want to take a dependency on any git executables, I just want to look in the .git directory. Can
I have a project under git. One day I moved all project files from current directory to foo/bar/ under the project. I did it using git mv. Then I added some more files and did some changes to already
I recently created a git repository on my server. Unfortunately during my last commit and push I had accidentally added all of my object files and some other junk files by mistake. Now when I do a git
I have a need to combine two files into one. One can simply copy and paste. However I wonder if git provides any mechanisms so that file combined will keep line history of both files? So when git blam
I have a String like this: 12/16/2011 12:00:00 AM now i want to show only date part i.e 12/16/2011 on Textview and remove the other part. What shall i need to do for this?? Any help will be appricate
I am currently creating topic branches: git checkout -b topic_branch ...do work... git checkout master git merge topic_branch but currently when I do this, I lose history of my 'topic_branch' and all
At my company, we are transitioning (fully) from ClearCase UCM to Git. We will not be using Clearcase after some time using Git. In the transition, are there any good tools that will bring the history
My git repo contains sensitive passwords which, for reasons out of my control, can't be removed right now. Right now it's all OK because this repo is internal-only, but I've been asked to create a bra