1

Is there any tool or a way to download/list only those files/folders which were changed and committed/pushed in a specific branch and it should not include those files which are unchanged since the branch was created till now.

The purpose is to make a zip archive as a build which will contains only the changed/modified files/folders only, so that other files should remain intact.

Thanks.

Arfeen
  • 2,553
  • 5
  • 29
  • 48
  • This should help: http://stackoverflow.com/q/4541300/6309 – VonC Mar 14 '16 at 10:01
  • @VonC I don't want to give commit ids, I want everything changed since the birth of this branch. – Arfeen Mar 14 '16 at 12:10
  • 2
    Git does not record "birth of branch"; you will have to do that separately. For instance, when you create the branch, you could create a tag as well: branch-foo goes with tag-mark-foo. Later, when you're ready to generate a diff, `git diff tag-mark-foo branch-foo` will get you the changes since the tag (which, since you tagged the point you want to diff from, is ... where you want to diff from). – torek Mar 14 '16 at 12:39

1 Answers1

0

As suggested in the comment above by @VonC you can use git diff-tree

Another way to do it is to use the git log in a various ways:

git log ^commit1 commit2
git log commit1 ^commit2
git log commit1...commit

Depends what you want to display.

For example:

Find out the base commit for the diff

git-merge-base

git merge-base finds best common ancestor(s) between two commits to use in a three-way merge.

Use this command to find out the commit to start with and then use the sample code below to print out the statistics.


# display the statistics of a given range,
# When given a range of commits to display
git log --stat --oneline HEAD...HEAD~5

enter image description here

CodeWizard
  • 128,036
  • 21
  • 144
  • 167