> From: Norike Abe <[email protected]>
>
> Is there a command to compare all the changes between two given commits a
> file has suffered, in a given set of lines of code?
There are a number of Git commands to investigate problems like this,
including "git blame" and "git diff".
A tool that I use is "git-history", which is a script to extract all
of the versions of a file that are contained in the current branch.
Once you have all versions of a file, you can use regular Unix tools
to determine many things about the history of the file.
Dale
----------------------------------------------------------------------
#! /bin/bash
# Get the historical versions of a file.
# First argument is the path of the file in question. It is
# interpreted as GIT interprets path arguments.
# Historical versions of the file will be extracted as
# basename.yyyy-mm-ddThh:mm:ss
# in the current directory, where the time is when "git log" notes the
# file (which I think is the first occurrence of that file content).
# The time is shown in the current local timezone.
FILE="$1"
BASENAME="${FILE##*/}"
git log --pretty=tformat:"%H %ci" --date=local -- "$FILE" |
while read HASH DATE TIME ZONE
do
R=( $( git ls-tree --full-tree $HASH "$FILE" ) )
if [[ -n "$R" ]]
then
NAME="$BASENAME.${DATE}T${TIME}"
echo "Creating $NAME..."
git cat-file -p ${R[2]} >$NAME
fi
done
----------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.