1

I've a repo which contains 2 directories

/repo/folder_1 /repo/folder_2

What is the command

  • to get the last commit id for the folder_2 changes
  • also the modified files in the last commit ?
Shikhar
  • 93
  • 7

2 Answers2

0

You can use two commands for this. First, show the commits on that folder, then show changes according to any commit shown by the first command.

git log --follow $YOUR_FOLDER
git show -p $COMMIT_ID
Rodrigo Loza
  • 1,200
  • 7
  • 14
0

If you really want it in a one liner you can do this:

# Find the commit of the folder you are interested in
git log -n1 --pretty=format:"%h" --follow $YOUR_FOLDER
# Find all the files that have changed
git show --pretty=" --name-only $COMMIT_ID

# And make it a one liner
git show --pretty="" --name-only `git log -n1 --pretty=format:"%h" --follow $YOUR_FOLDER`
uncletall
  • 6,609
  • 1
  • 27
  • 52