Re: [git-users] git add "This file is for the blah class"
(H.24/08/20 8:03), Mark Adam wrote: Yes, that's all decent, but I'm trying to create a habitual methodology about the documentation of files so that it helps the community as standard practice. The perfect place is really on the git add command line. I don't think it is. "git add" isn't there to add files to the repository; it is there to add content to the staging area. There is a fundamental difference. Firstly, you use it to add modifications to files which already exist, so there is no reason to suppose attaching a note to "git add" means that note belongs to the action, "user added a file". Secondly, git tracks content, not files, so I don't think you will have much luck pushing for special actions related to the addition/removal of files. The correct approach is to put the note in the log for the commit which adds the file, and then pass parameters to log which will help you find those commits which add files. "git whatchanged" might be a good starting point. Alternatively you could look at the "--name-status" parameter to "git log", which is more or less what "git whatchanged" uses anyway, I think, but might allow you a bit more customisation. Look at the manpages for details. If you want to get the message for just one file, rather than for all commits where files were added, you could easily write a git alias, say "git purpose", which takes a filename as a parameter, finds the commit in which it was added, and displays the log message for that commit. Something like $ git log --pretty=medium --reverse -1 would give you the first commit for a file, which is usually going to be the one in which it was added (unless you need to handle the case where a file is added, later removed, and a different file is then later added which has the same name -- in which case some cleverness with "git whatchanged" should be able to get you the most recent addition). If you really wanted you could write your logs in a special format which your "git purpose" alias could then parse, so that only the portion of the commit log related to the purpose of that file got printed. None of this will "help the community as standard practice", but I am not sure how much "the community" wants/needs that help. Maybe worth trying it yourself as proof-of-concept first before trying to push for it to be a mainstream feature. The great thing about git is that it's flexible enough that you *can* adjust it to suit your needs, so styling it to your own workflow is possible and encouraged! Dani. -- 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.
Re: [git-users] git add "This file is for the blah class"
On Sun, Aug 19, 2012 at 5:49 PM, NightShade wrote: > Maybe something like > > Create initial version of class file or files “maybe even empty files” > then use git add and git commit to store them in the repo and finally git > notes to add the description. > > ** ** > > Since I mainly use git with drupal and just need to record when I create a > site specific folder or add / update a module I have a very basic working > knowledge of git. Based on how I interpret the below excerpt from the > git-notes man page I think the above would work as long as there is not a > commit between the initial addition/commit of the class files and the note. > > > ** ** > > This is from the git-notes man page at kernel.org > > A typical use of notes is to supplement a commit message without changing > the commit itself. Notes can be shown by *git log* along with the > original commit message. > > ** ** > > > Yes, that's all decent, but I'm trying to create a habitual methodology about the documentation of files so that it helps the community as standard practice. The perfect place is really on the git add command line. I would suggest it at the main dev list, but I recently signed on and have established any status there So will wait... mark -- 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.
RE: [git-users] git add "This file is for the blah class"
In the past with drupal sites that I've worked on I have used hidden files in my sites/site-name folder so that I can record in the commit history that the folder was created. Perhaps something along a similar like might work with notes. Maybe something like Create initial version of class file or files "maybe even empty files" then use git add and git commit to store them in the repo and finally git notes to add the description. Since I mainly use git with drupal and just need to record when I create a site specific folder or add / update a module I have a very basic working knowledge of git. Based on how I interpret the below excerpt from the git-notes man page I think the above would work as long as there is not a commit between the initial addition/commit of the class files and the note. This is from the git-notes man page at kernel.org A typical use of notes is to supplement a commit message without changing the commit itself. Notes can be shown by git log along with the original commit message. From: git-users@googlegroups.com [mailto:git-users@googlegroups.com] On Behalf Of Mark Adam Sent: Sunday, August 19, 2012 4:30 PM To: git-users@googlegroups.com Subject: Re: [git-users] git add "This file is for the blah class" On Sun, Aug 19, 2012 at 5:24 PM, NightShade wrote: Mark, Have you looked into the notes subcommand for git? I have not personally used it myself so I'm not certain if it will work for what you want or not but it does sound like it would at least be a start for the type of functionality your looking for. Well, I'd like to tie the notes to specific files, so that github and the like can use them in displaying code. I don't think a generic notes will do the job mark -- 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. -- 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.
Re: [git-users] git add "This file is for the blah class"
On Sun, Aug 19, 2012 at 5:24 PM, NightShade wrote: > Mark, > > ** ** > > Have you looked into the notes subcommand for git? I have not personally > used it myself so I’m not certain if it will work for what you want or not > but it does sound like it would at least be a start for the type of > functionality your looking for. > > Well, I'd like to tie the notes to specific files, so that github and the like can use them in displaying code. I don't think a generic notes will do the job mark -- 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.
RE: [git-users] git add "This file is for the blah class"
Mark, Have you looked into the notes subcommand for git? I have not personally used it myself so I'm not certain if it will work for what you want or not but it does sound like it would at least be a start for the type of functionality your looking for. Chris From: git-users@googlegroups.com [mailto:git-users@googlegroups.com] On Behalf Of theProphet Sent: Sunday, August 19, 2012 12:46 PM To: git-users@googlegroups.com Cc: g...@vger.kernel.org Subject: [git-users] git add "This file is for the blah class" I'm finding it annoying when browsing repositories at github and such that the description on every file and directory is only the last commit message given for that file. I think it would be much more organizationally useful if the "git add" command accepted a message that will be associated with that file that describes its purpose. A file name just isn't adequate to do the job and there's nowhere else where this is tracked. Thanks guys! mark github/Social-Garden. -- 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/-/z8QL0uzNBCIJ. 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. -- 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.