View the change history of a file using Git versioning

How can I view the change history of an individual file in Git, complete details with what has changed? I have got as far as: git log -- [filename] which shows me the commit history of the file,...

What does "use strict" do in JavaScript, and what is the reasoning behind it?

Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error: > Problem at line 1 character 1: Missing "use strict" statement. Doing some searching, I...

How to change the URI (URL) for a remote Git repository?

I have a repo (origin) on a USB key that I cloned on my hard drive (local). I moved "origin" to a NAS and successfully tested cloning it from here. I would like to know if I can change the URI of...

Git refusing to merge unrelated histories on rebase

During git rebase origin/development the following error message is shown from Git: fatal: refusing to merge unrelated histories Error redoing merge 1234deadbeef1234deadbeef My Git version is...

How to change the commit author for one specific commit?

I want to change the author of one specific commit in the history. It's not the last commit. I know about this question - How do I change the author of a commit in git? But I am thinking about...

How to grep (search) committed code in the Git history

I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)? A very poor solution is to grep the log: git log -p | grep...

How do I migrate an SVN repository with history to a new Git repository?

I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like: SVN repository in:...

How to find a deleted file in the project commit history?

Once upon a time, there was a file in my project that I would now like to be able to get. The problem is: I have no idea of when have I deleted it and on which path it was. How can I locate the...

Detach (move) subdirectory into separate Git repository

I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository. How...

Pretty Git branch graphs

I've seen some books and articles have some really pretty looking graphs of Git branches and commits. How can I make high-quality printable images of Git history?

How to remove/delete a large file from commit history in the Git repository?

I accidentally dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and...

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big...

Is it possible to move/rename files in Git and maintain their history?

I would like to rename/move a project subtree in Git moving it from /project/xyz to /components/xyz If I use a plain git mv project components, then all the commit history for the xyz project...

How to undo "git commit --amend" done instead of "git commit"

I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file. Is there a way to undo that last commit? If I do...

Search all of Git history for a string?

I have a code base which I want to push to GitHub as open source. In this git-controlled source tree, I have certain configuration files which contain passwords. I made sure not to track this file...

Why is "1000000000000000 in range(1000000000000001)" so fast in Python 3?

It is my understanding that the range() function, which is actually an object type in Python 3, generates its contents on the fly, similar to a generator. This being the case, I would have...

How to find/identify large commits in git history?

I have a 300 MB git repo. The total size of my currently checked-out files is 2 MB, and the total size of the rest of the git repo is 298 MB. This is basically a code-only repo that should not be...

How do I clear/delete the current line in terminal?

If I'm using terminal and typing in a line of text for a command, is there a hotkey or any way to clear/delete that line? For example, if my current line/command is something really long...

how to delete all commit history in github?

I want to delete all commit history but keep the code in its current state because, in my commit history, there are too many unused commits. How can I do it? Is there any git command can do...

Remove sensitive files and their commits from Git history

I would like to put a Git project on GitHub but it contains certain files with sensitive data (usernames and passwords, like /config/deploy.rb for capistrano). I know I can add these filenames to...

Is the Scala 2.8 collections library a case of "the longest suicide note in history"?

I have just started to look at the Scala collections library re-implementation which is coming in the imminent 2.8 release. Those familiar with the library from 2.7 will notice that the library,...

Remove folder and its contents from git/GitHub's history

I was working on a repository on my GitHub account and this is a problem I stumbled upon. Node.js project with a folder with a few npm packages installed The packages were in node_modules...

Removing an activity from the history stack

My app shows a signup activity the first time the user runs the app, looks like: ActivitySplashScreen (welcome to game, sign up for an account?) ActivitySplashScreenSignUp (great, fill in this...

How to move some files from one git repo to another (not a clone), preserving history

Our Git repositories started out as parts of a single monster SVN repository where the individual projects each had their own tree like so: project1/branches /tags ...

Unlimited Bash History

I want my .bash_history file to be unlimited. e.g. So I can always go back and see how I built/configured something, or what that nifty command was, or how some command broke something weeks ago....

How to grep Git commit diffs or contents for a certain word

In a Git code repository I want to list all commits that contain a certain word. I tried this <!-- language: lang-sh --> git log -p | grep --context=4 &quot;word&quot; but it does not necessarily...

Commit history on remote repository

I am trying to access a branch's commit history on a remote repository. I had a look at the doc but could not find any substantial information on how to access a remote repo's commit history using...

How to permanently remove few commits from remote branch

I know that's rewriting of history which is bad yada yada. But how to permanently remove few commits from remote branch?

How can I turn off "scrolling the history" in iTerm2

I have installed the new iTerm 2. It asked me in a yellow bar at the top if I'd like to enable a mouse feature. Unfortunately I don't remember the exact sentence anymore. By accident I approved....

How can I split up a Git commit buried in history?

I flubbed up my history and want to do some changes to it. Problem is, I have a commit with two unrelated changes, and this commit is surrounded by some other changes in my local (non-pushed)...