Not sure whether this youtube video is too easy, but I found this video is extremely easy to understand and have funny (gamer-ish) illustration of git: Git Tutorial For Dummies
I see that (files in read-only) as a way to avoid errors. In Perforce itās not uncommon that I start modifying a file in the wrong branch, but Iām aware of the mistake as soon as I try saving the file (because I canāt).
What do you mean by āno central serverā? On my side I meant the depot for a given project, I did not mean that it was unique for all GIT projects worldwide :). Do you also mean that GIT can be used fully locally without any depot (so no push/pull/ā¦)?
Yes. You can have a single, local git repository not linked to any other repository. Also, the git āprotocolsā do not treat any specific remote/clone as the authoritative copy. Try this:
mkdir repo1
cd repo1; git init; cd ..
cp -a repo1 repo2
cd repo1; git remote add origin ../repo2; cd ..
cd repo2; git remote add origin ../repo1; cd ..
At this point, you have two local repositories, each of which considers the other as āoriginā. You can work in either one, and push or pull from either.
I use git for my textual teaching materials (LaTeX handouts, programsā¦), not intended to be put online. It is a good way to keep track of what I have modified year after year.
Maybe a bit off-topic in this discussion (if it is, the moderators are free to split the threadā¦):
Does someone uses Git+Github (or another repository) as a personal notes placeholder? For those who do, do you find it convenient?
I have been using OneNote for years, primarily at work anf then at home, I find it convenient, but with a major drawback to me: the storage format is proprietary, which means that the content is stuck to the software. And this is even worse on macOS, as the only way to use it is online, with just some cache on the local machine (at least on Windows it can be both, local storage+synchro).
So Iām looking at alternative ways, and using markdown files organised in a folder tree is really all I need. And with git it could be synchronised to Github, and the site can even be used a note browser/editor.
You might want to take a look at org-mode. Iāve never used it myself, but it seems that everyone that does use it thinks itās the best thing in the world! Iām presuming as all notes are simply markdown files, it would play ball with Git(Hub).
Personally I use Notion. Itās awesome, but I do also worry about the vendor lock-in. I might give org-mode a go some dayā¦
I have been using markdown for my notes for quite some time now. VS Code has tons of extensions (markdown all in one combines a few) for md support with latex, mermaid, links, images,ā¦
So indeed, coupled with GitHub, thatās quite convenient.
To get you closer to the hierarchical organization of OneNote, you can try Dendron. I started recently to use it and I am quite happy with it.
I have been using Git+Github for this purpose since I started my PhD. I think this will be the most portable/flexible solution to your problem. If you use VS Code, you can further improve your user experience by installing the Git extension and, as @davidpfister commented, one of the widely available Markdown extensions.
Yeap, I use it a lot, not only for notes which I take either in markdown or plain text, but also for papers, reports and generally LaTex documents. It makes versioning documents and cloud-storage quite trivial. Also, most of these repositories are private so only I and invited collaborators have access.
I have a private GitHub repo called notes. Itās a loose organization of directories with Markdown and plain text file. In the top level directory, I have a tiny bash script called sync:
#!/bin/bash
#
# First pulls updates, then pushes new changes.
git pull origin main
git add * && git commit -m "Update on $(date)" && git push origin main
I run sync any time I start writing. For me it can happen from 3 different computers so I just always run it first so I donāt have to remember if I changed computers. Then I write notes in the terminal from NVim. You could further automate syncing by telling Vim or Emacs to run sync on save.
A few comments on this system from my experience:
Main pro is that itās fast thanks to terminal + terminal-based editor. I can get from zero to starting a new note in ~5 s (open terminal; cd notes; vi my-new-note.txt)
I use a mix of Markdown and plain text. For quick and dirties that I just need to store some info on, I write in plain text. For longer notes that I expect to review later, I write in Markdown.
Because GitHub nicely renders the directory tree and Markdown files (headings, code blocks, even math with MathJax), I get a nice note reader for free.
sync could be easily extended to also parse the updated directory tree and generate a nicely formatted TOC in the README.md.
Note that GitHub here is really only a free git server + Markdown renderer. You could do this entirely without GitHub and rely only on git on your own server.
Downsides (for me; it will be different for others):
I canāt write notes from my phone.
Git not intended for binary files, so I donāt put images in my notes. But, most if not all operations are creating new notes or appending to existing ones (rather than editing or deleting), so adding images here under git is no different from adding them anywhere else (data has to be stored somewhere).
Iāve been trying out different note-taking systems for many years and havenāt found anything that stuck as long as this one (1.5 years and going). Iāve used Notion for a similar amount of time but eventually dropped it because it was getting just too slow.
It has a plugin API and the community just converted this into a massive platform. I have thousands of pages at work to keep my own notes for the week. powered by synced Obsidian handwritten notes, PDFs, videos, markdown pages etc. from my tablets and desktop.
FWIW, Notion has got a bit faster in the last year or so. Speed wise, for me itās gone from āpainfullā to āacceptableā. But Iād definitely still put it in the sluggish category. The main advantage to me is that I can turn it into a fully fledged project management system with push notifications.
Thanks for the tip. I have put the script in a folder that is in the PATH, and with a slight modification it can be called from anywhere in the local copy of the repository (the pull/push commands can be called from any subfolder, but add * should be called from the top level to not miss any new file):
while [ 1 ] ; do
if [ -d ".git" ] ; then
git pull
git add * && git commit -m "Update on $(date)" && git push
break
fi
[ "$(pwd)" = "/" ] && break
cd ..
done
I will however start with something raw (i.e. just hand-managed md files + Github), and will look at more sophisticated softs if the raw approach doesnāt fit (Iāve seen also āzettlrā, that looks like a fully open source obsidian-like)
Iāve been using git for a few months now and like it but wish there were a tool to automate
commit messages, since many of them could be inferred by comparing the old and new versions of a file. For example, git log stats.f90 on my PC gives (excluding metadata)
added optional argument ypred to simple_linear_reg
added subroutine simple_linear_reg
added argument nacf to subroutine print_basic_stats_vec
added arguments sym and print_stats_names to subroutine print_basic_stats_vec
So Iād like a tool that compares two versions of a module, lists procedures that were added, removed, or modified, and if modified by changing arguments, lists the arguments added or deleted.
There could be an LLM plugin for git that scans the changes to files and emits a thorough and human-readable commit message. Definitely a feature Iād use.
I have been using Copilot in VS Code (for quite a while now) and they have added such functionality. I donāt always use it since I prefer formatting commit messages using a specific style, but they offer such functionality and it is decent.