Make a Lasting Impression





Helpful git commands
Home away from home
Joined:
2007/12/4 9:00
Posts: 4236
Here's the first one - used it tonight to create the 'upgrade' package for 1.3.x to 1.3.8

Note: I use Ubuntu, so it won't work on a Windows machine!


git diff
-tree ---no-commit-id --name-only --diff-filter=ACMRT [old commit hash] [new commit hash] | xargs tar -cvzf filename.tar.gz


Here's how the command breaks down -


git diff
-tree -[old commit hash] [new commit hash]


Take a diff of the given commit to the older commit (including all subdirectories, not just the top directory).


--no-commit-id --name-only


Do not output the commit SHA1. Output only the names of the affected files instead of a full diff.


--diff-filter=ACMRT


Only show files added, copied, modified, renamed or that had their type changed (eg. file → symlink) in this commit. This leaves out deleted files.


xargs tar -cvzf filename.tar.gz


Send the output to a tar.gz file. You can also run without this to just get a list, or send to a text file.

Posted on: 2015/8/30 3:50
_________________
Steve
Twitter: @skenow
Facebook: Steve Kenow
Transfer the post to other applications Transfer


Re: Helpful git commands
Home away from home
Joined:
2009/3/3 4:18
From Belgium
Posts: 1943
Great contribution Steve, I'll try to integrate this into the Phing build file. Once we have the build file, that should make this kind of issues go away in newer releases I hope.

Posted on: 2015/8/30 7:29
_________________
d-log - My personal site
Openhub profile
Transfer the post to other applications Transfer


Re: Helpful git commands
Home away from home
Joined:
2007/12/4 9:00
Posts: 4236
There is a variant that is all git commands -


git archive 
-o filename.zip [commit hash new] $(git diff --name-only --diff-filter=ACMRT [commit hash old] [commit hash new])


It will create either a zip or a tar.gz archive, guessing which from the file extension. Or you can specify the type using -format=[type]

http://git-scm.com/docs/git-archive

Here's an example for getting the files changed between the 1.3.8 Final release and the 1.3.9 RC release:


git archive 
-o impresscms-138-139rc.zip 8b451c0 $(git diff --name-only --diff-filter=ACMRT b182a01 8b451c0)


I run this when I'm in my git repository directory for ImpressCMS

Posted on: 2015/9/1 1:43

Edited by skenow on 2016/2/27 21:44:09
_________________
Steve
Twitter: @skenow
Facebook: Steve Kenow
Transfer the post to other applications Transfer


Re: Helpful git commands
Home away from home
Joined:
2007/12/4 9:00
Posts: 4236
I just had to update the sample command - I had an extra parameter in the diff portion and a missing one in the archive portion.

It's all good now - just tested and created my update package.

Posted on: 2016/2/27 22:02
_________________
Steve
Twitter: @skenow
Facebook: Steve Kenow
Transfer the post to other applications Transfer


Re: Helpful git commands
Home away from home
Joined:
2009/3/3 4:18
From Belgium
Posts: 1943
Great! This will make the creation of update packages that much easier. Thank you very much, I'll have a use for this this evening I think

Posted on: 2016/2/29 12:51
_________________
d-log - My personal site
Openhub profile
Transfer the post to other applications Transfer


Re: Helpful git commands
Just popping in
Joined:
2/24 6:41:53
Posts: 1
Thank you very much for the latest updates.

Posted on: 2/24 6:44:14
Transfer the post to other applications Transfer






You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]