→ node [[git]]

Local Git Exclude

Edit the local exclude file in your git repo without having to edit the global .gitignore

.git/info/exclude

Source: StackOverflow

Counting files in a git repo

git ls-files | wc -l

Source: Stackoverflow

Git is a popular version control system.

Tricks

Writing a Git Commit Message

Article Reference

  • Concise and consistent length and form

  • Communicate clear context about a change to fellow developers. Ensure that other developers understand why a change was made.

Rules

  • Separate subject from body with a blank line if the body is to be used.

  • Limit subject line to 50 characters

  • Capitalize subject line

  • Do not end with period

  • Use imperative mood; I 'do' this. Rationale: If applied, the commit will change these aspects of the code. Git's own built-in conventions use this form.

  • Wrap at 72 characters

  • Use the body to explain 'what' and 'why' as necessary

Repositories

  • GitHub :: I use this; Microsoft is bad but the community is good

  • Sourcehut :: Minimal free software repository. I would use this if the developer weren't an egotistical BDFL.

  • Gitea :: Open source git repository; self host it

Organization Thoughts

github organization:

  • one repo per course - as most courses require partner work

= repo for coding challenge practice problems

  • managing research notes: ??? i am thinking a single org file for all of this

  • - that is, an org file in each project for the research notes pertaining to that project,

  • - and anotherorg file for misc. research ?? i will have to see how my research is used

https://danieltakeshi.github.io/2017/07/15/how-i-organize-my-github-repositories/

Rewriting

It's a good idea to reformat commits to make them more readable.

git reset HEAD~${number of commits to go back}

Tricks

http://joeyh.name/blog/entry/how_to_publish_git_repos_that_cannot_be_republished_to_github/ :: cheeky way to abuse DMCA to avoid GitHub using your Git repos https://sourcehut.org/blog/2020-10-29-how-mailing-lists-prevent-censorship/ using the mailing list model over the built-in issue model, and how this naturally federated and local first procedure is superior to github's standard issue approach https://sagegerard.com/git-debugging.html: use git bisect while referencing maintainers of specific parts of code to narrow down to the code you should care about, then ask the maintainers about it - while putting in a minimum of effort. https://labs.consol.de/development/git/2017/02/22/gitignore.html using .gitignore the right way

Patch previous commits with rebases

https://stackoverflow.com/questions/9103396/how-do-i-edit-a-previous-git-commit If you need to change commit history:

  • Make another commit to make the change

  • Rebase starting at the commit you want to change

  • Squash the new commit with the old one in the history

  • Remove the second commit message (or merge it...)

This did change the commit time for my latest commit, which is something to watch out for.

How Git Works

Neat writeup on the Git patience diff algorithm "Distributed, offline-first bug tracker embedded in git, with bridges" Prototype Git GUI for Filmmaking "Pull github, bitbucket, and trac issues into taskwarrior" Text-mode interface for git bcongdon/git-trophy: ? Create a 3D Printed Model of Your Github Contributio

Worktrees

  • A git repository can have multiple working trees - allowing you to check out more than one workspace at a time!

    • Among other things, this allows you to work on multiple branches at once without having multiple copies of the file, and maps git branches or tags to other directories on your system. Use it to check on different efforts on projects without messing up your current editing environment - to look at code from other branches locally and simultaneously, for example!

  • git worktree add $PATH :: Adds a new branch with a name associated with the final component of $PATH. git worktree remove and git worktree prune both allow you to cut off external worktrees.

  • Flow example: latest develop, latest branch of work, and a third for reviewing pull requests and/or the work from other developers.

Github

track changes to a patch over time git flow git extensions for high level repository operations explore git cli with natural language search github is sinking

READMEs

A curated list of awesome Github Profile READMEs 📝 https://github.com/pifafu/pifafu/blob/main/readME.md i love the font choice and the gif here!

Alternatives

Table of Contents

[2020-04-19] The Communicative Value of Using Git Well – Math ∩ Programming [[git]]

[2017-05-06] use hg-fast-export to convert [[mercurial]] [[git]]

[2016-09-07] git stores snapshots, not diffs [[git]]

Different from SVN
It is important to note that this is very different from most SCM systems that you may be familiar with. Subversion, CVS, Perforce, Mercurial and the like all use Delta Storage systems - they store the differences between one commit and the next.
Git does not do this - it stores a snapshot of what all the files in your project look like in this tree structure each time you commit. This is a very important concept to understand when using Git.
Git’s pack files are carefully constructed to effectively use disk caches and provide “nice” access patterns for common commands and for reading recently referenced objects.

NOCOMMIT global hook? [[git]]

[2019-08-18] Highlights from Git 2.23 - The GitHub Blog [[git]]

https://github.blog/2019-08-16-highlights-from-git-2-23/

You may have used git grep to search for some text in your Git project, just as you may have used git diff to view active changes. What do the two have in common? They both display some contents in your repository, and both have support to show the surrounding function context with -p (short for --show-function) or -W (short for --function-context), respectively.

Git blame ignore formatting [[git]]

Configure your git blame to ignore cleanup changes.

https://www.moxio.com/blog/43/ignoring-bulk-change-commits-w

[2019-08-24] Fossil Versus Git | Lobsters [[git]]

https://lobste.rs/s/e3blgf/fossil_versus_git

This article is getting a few things about git wrong. They claim git only supports ‘One check-out per repository’. Heard of git worktree?

My unorthodox, branchless git workflow | Lobsters [[git]]

Git revise is especially useful for this commit stack workflow, as I call it. I’m a huge fan.

It’s a better rebase. So much better that it should be obligatory. You can split commits, batch rename them, and you don’t have to stash your work first.

a page with my favourite git commands & tricks? [[git]] [[toblog]] [[exobrain]]

wsdiff
image diff
nbstirpout
iadd
extra worktree dir

The Communicative Value of Using Git Well – Math ∩ Programming [[git]]

I’ve written up my ideas, under the name ‘Literate Git’, at https://github.com/bennorth/literate-git if you’re interested.
The tool I wrote turns a structured git history into an interactive web page.
There’s an example there of how the ideas might work in a tutorial setting.
After I gave a talk on this work, one of the people in the audience tried it with the Haskell LLVM tutorial: https://lukelau.me/kaleidoscope/

[2019-08-02] git - How do I remove a submodule? - Stack Overflow [[git]]

https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule/21211232#21211232

git rm the_submodule
rm -rf .git/modules/the_submodule

[2019-12-11] git reflog expire –expire=now –all && git gc –prune=now –aggressive [[github]]

[2019-05-10] git rebase –committer-date-is-author-date –autostash HEAD~1 [[git]]

[2020-06-08] Learn to change history with git rebase!

[2018-11-28] extraction - How to extract one file with commit history from a git repo with index-filter & co - Stack Overflow [[git]]

https://stackoverflow.com/questions/7375528/how-to-extract-one-file-with-commit-history-from-a-git-repo-with-index-filter/37037151

git filter-branch --index-filter 'git read-tree --empty; git reset $GIT_COMMIT -- $your $files $here' -- --all --

[2019-04-10] set up git project commmand

[2020-07-12] - GitHub + why do we centralize issues, documents for a distributed version… | Hacker News

for an academic treatment of the defects in Git read: What's Wrong with Git? A Conceptual Design Analysis S. Perez De Rosso and D. Jackson. In Proceedings of the 2013 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming & Software (Onward! 2013) 

[2018-01-01] detect file type changes [[git]]

for r in *; do pushd $r; git whatchanged | grep "\.\.\..T"; popd; done

git ssh debugging [[git]] [[ssh]]

GIT_SSH_COMMAND='ssh -v' git fetch

[2021-01-11] How to keep your Git history clean with interactive rebase | GitLab

[2020-11-16] Why Git blame sucks for understanding WTF code (and what you should use instead) | Lobsters

For archeology I really love git gui blame despite its dated UI

[2019-07-21] git - How do I remove a submodule? - Stack Overflow https://stackoverflow.com/questions/1260748/how-do-i-remove-a-submodule/7646931#7646931 [[git]]

he majority of answers to this question are outdated, incomplete, or unnecessarily complex.

A submodule cloned using git 1.7.8 or newer will leave at most four traces of itself in your local repo. The process for removing those four traces is given by the three commands below:
⥅ pulled node [[git-alias]]

Git Alias

⥅ pulled node [[git-config]]

Git Config

git config --local commit.template commit-template.txt
git config --global user.name "Flancian"
git config --global user.email "0@flancia.org"
⥅ pulled node [[git-ship]]
⟴ stoa (shared document) at doc.anagora.org/git
⥱ context
⥅ context node [[2021-07-18]]
⥅ context node [[exobrain]]
⥅ context node [[git]]
⥅ context node [[github]]
⥅ context node [[linus-torvalds]]
⥅ context node [[mercurial]] (empty)
⥅ context node [[mercurial]] (empty)
⥅ context node [[ssh]]
⥅ context node [[toblog]] (empty)
⥅ context node [[toblog]] (empty)
⥅ context node [[version-control-system]] (empty)