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'.

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.


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


--
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/1ec21f20-cac1-38eb-fdb8-4fb2152e5390%40iee.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to