On 13/07/2019 19:50, CrestChristopher wrote:

On 7/13/2019 1:37 PM, Philip Oakley wrote:
On 12/07/2019 12:58, CrestChristopher wrote:
Is it possible to take snippets of code along while also including a description of what the code is intended to do and push it to a git, so I have a repository of code snippets,
It can be done. However there are a few issues regarding 'alignment' between the classic Git (take a snapshot of working files) approach and your desire to also have 'context'.

What do you mean ?
A code snippet is not complete code. Git is designed to manage a complete code base. Ancillary descriptions of the code are not linked directly to the code within Git. Multiple code snippets are likely to need to be arranged.  These are some of the differences in 'context'.



since I know git is for version control as I tend to like to have code snippets for reference ?
Valid points.

Also can you push files within a git to another git; for example, push a repository or the files in the repository from github to another git ?
No, not directly. One pushes the whole commit and it's ancestors to the destination repo, so it is not selective. However if you have resolved how you record the context then it's not a real problem.

What do you mean, resolved how you record the context ?
Correct, It was saying " you have worked out how to capture the 'context' (the points noted above)"




One option is to add each code snippet as a distinct snippet file (maybe under a 'snippets' director?); Then add each snippet individually and commit that snippet with a message that has your "description of what the code is intended to do", and a Subject that is "filename: short one-line summary". Then when you 'git log' that snippets branch (oneline version) you get your 'catalog' of snippets and can select as appropriate.

Git is normally incrementally additive while a snippet data base considers each part as discrete, so one has to manage that difference.

Philip


I'm currently using github, although I want to run my own private git that is turning out to be a problem getting a kernel updated.

I don't understand what you mean by the last part ?
The last part is the same as my comment above "Multiple code snippets are likely to need to be arranged.".

If you already have a method in use (no matter how good or bad it is), it is worth starting from there and then 'improving' it in the direction of Git compatibility if you want to use Git. The alternative is to choose an alternative storage technique if that looks better, and then maybe store that entity in Git.

Picking the best bits of your current method will be a good start.

Philip
(from my new email address)

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/febef993-86e3-62cd-cc19-525314734d16%40iee.email.
For more options, visit https://groups.google.com/d/optout.

Reply via email to