[git-users] Best Practices

2012-02-08 Thread FD
Hello,

I'm new to git and I used svn before.
I would like to know what are the best pratices when one generates an
executable to be able to retreive sources related to the executable.
With svn. It was automatic. I had a file, when updated, that get
automatically the svn-revision number and other tags. If I generated
an executable at any time I can always know from the executable how
the retreive  the corresponding sources with a function to read the
file with tags.
Is there a way to do it automatically with git or have I to generate a
tag in git and than write it in file file that will be included in the
executable?

Many thanks

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Best Practices

2012-02-08 Thread Thomas Ferris Nicolaisen
If I may reformulate your question: how can I include revision information 
in my build?

As far as I can remember, in SVN some did it differently by having a 
keywords in files that would be replaced during commit (a similar question 
is discussed here on 
StackOverflowhttp://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html.
).

Now I'm a bit unsure what you want, but I'll assume you want to know the 
HEAD revision of the repo of which you are building, and put this into some 
file.

It is usually the job of the build-tool to fetch and include this 
information. So somewhere in your build-script, you need to do something 
like this:

$ echo Timestamp: `date`  version.txt
$ echo Revision: `git rev-parse HEAD`  version.txt
$ echo Tag: `git name-rev --tags --name-only HEAD`  version.txt

The resulting file:
$ cat version.txt
Build version information:
Timestamp: Wed Feb 8 12:27:28 CET 2012
Revision: 36909b1d55aa47a5c484808ce5cc5cbe06ed93e4
Tag: undefined

Different build tools have different ways of doing this. There could be 
that there is a plugin or feature in your build tool that produces a 
similar file.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/Qdglyq9LiaIJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Best Practices

2012-02-08 Thread FD
Thanks, it's what I need.

What other informations can I obtain on HEAD and how?
Is it possible to know the author, branch?
maybe with git show HEAD ...


On 8 fév, 12:30, Thomas Ferris Nicolaisen tfn...@gmail.com wrote:
 If I may reformulate your question: how can I include revision information
 in my build?

 As far as I can remember, in SVN some did it differently by having a
 keywords in files that would be replaced during commit (a similar question
 is discussed here on 
 StackOverflowhttp://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keyword
 ).

 Now I'm a bit unsure what you want, but I'll assume you want to know the
 HEAD revision of the repo of which you are building, and put this into some
 file.

 It is usually the job of the build-tool to fetch and include this
 information. So somewhere in your build-script, you need to do something
 like this:

 $ echo Timestamp: `date`  version.txt
 $ echo Revision: `git rev-parse HEAD`  version.txt
 $ echo Tag: `git name-rev --tags --name-only HEAD`  version.txt

 The resulting file:
 $ cat version.txt
 Build version information:
 Timestamp: Wed Feb 8 12:27:28 CET 2012
 Revision: 36909b1d55aa47a5c484808ce5cc5cbe06ed93e4
 Tag: undefined

 Different build tools have different ways of doing this. There could be
 that there is a plugin or feature in your build tool that produces a
 similar file.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: How can I know which line was changed in git ?

2012-02-08 Thread Jeenu


On Tuesday, February 7, 2012 11:21:57 AM UTC+5:30, paymaster wrote:

 Hi 

 I'm making some kind of testing tool. 
 This tool needs what line changed information in file. 
 But I could not found that information by git command. 


There's no single command that'd give you that information. But here's how 
you can get close:

Assume COMMIT is the commit that you want to know more about. git show 
--name-status COMMIT will show you the list of files that's part of the 
commit (modified, added or deleted etc.). If FILE is modified in COMMIT, 
you could do git blame COMMIT -- FILE and grep for COMMIT in the output 
which will give you the list of lines in which the file was changed. In 
summary:

git show --abbrev-commit --diff-filter=M --name-only --pretty=oneline 
COMMIT | sed -n '2,$p' # Gives the list of modified files
git blame COMMIT -- FILE | grep COMMIT # List of lines modified

See git help blame for additional options.

HTH.

-- 
Jeenu

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/p7K-NYyNUXkJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: Best Practices

2012-02-08 Thread FD
I found git show --format=XXX HEAD

On 8 fév, 13:40, FD du...@hotmail.com wrote:
 Thanks, it's what I need.

 What other informations can I obtain on HEAD and how?
 Is it possible to know the author, branch?
 maybe with git show HEAD ...

 On 8 fév, 12:30, Thomas Ferris Nicolaisen tfn...@gmail.com wrote:







  If I may reformulate your question: how can I include revision information
  in my build?

  As far as I can remember, in SVN some did it differently by having a
  keywords in files that would be replaced during commit (a similar question
  is discussed here on 
  StackOverflowhttp://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keyword
  ).

  Now I'm a bit unsure what you want, but I'll assume you want to know the
  HEAD revision of the repo of which you are building, and put this into some
  file.

  It is usually the job of the build-tool to fetch and include this
  information. So somewhere in your build-script, you need to do something
  like this:

  $ echo Timestamp: `date`  version.txt
  $ echo Revision: `git rev-parse HEAD`  version.txt
  $ echo Tag: `git name-rev --tags --name-only HEAD`  version.txt

  The resulting file:
  $ cat version.txt
  Build version information:
  Timestamp: Wed Feb 8 12:27:28 CET 2012
  Revision: 36909b1d55aa47a5c484808ce5cc5cbe06ed93e4
  Tag: undefined

  Different build tools have different ways of doing this. There could be
  that there is a plugin or feature in your build tool that produces a
  similar file.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.