0

I want get latest changed files of my repository.

to do it:

I have run this command to get latest Commit ID:

git log --format="%H" -n 1 

and then I paste output to this command:

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT "PREV_COMMAND_OUTPUT" | xargs tar -rf changedFiles.tar 

Now, how I can merge These commands and pass output if first output as argument of second command?

thanks

1 Answer 1

1

If you are on linux (OSX might also work) and have access to a real shell (sorry, windows won't work) you can use command substitution:

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $(git log --format="%H" -n 1) | xargs tar -rf changedFiles.tar 

or

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT `git log --format="%H" -n 1` | xargs tar -rf changedFiles.tar 

But since you're always using the last commit ID, you might as well just replace the whole command with HEAD

git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT HEAD | xargs tar -rf changedFiles.tar 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.