SyntÉ™ RSS repo @m
bandcamp
say hi!
back

02/11/2025

Git Workflow

Or, why the command line is so scary 👻

So, you have a computer and you spend tine telling it what to do. Sometimes you’re moving a mouse around, sometimes you’re typing stuff in.

What if you used the mouse for continuous movement things like drawing, and did everything else by typing?

First thing is - use the computer how you want.
If you’re curious about other ways then read on

What is the CLI?

Ok so this thing has a few names that mean slightly different things. Why? Who knows.
The names are:

brief explainer - CLI stands for command line interface, the terminal is the app or program that provides this interface and the shell is the software that runs in it - what you’re interacting with.

why on earth would I want to do this?

Well here are some possibilities:

I’m not sure why I got into it, well actually I do know - I saw this video and thought it looked really cool lol:

https://inv.nadeko.net/tc4ROCJYbm0

Basically I wanted to do computing like that (feet on desk optional)

This might seem quite an odd reaction to a film made in 1982, but maybe I’m quite odd ha.

The desktop computers you can see there are not actually PCs (they hadn’t been invented yet) but terminals that connect to a larger machine (at least I think that’s the case)
This is where the name terminal comes from, the one you can use is a virtual simulation, hence the full name: terminal emulator.

anyone who is still awake may now proceed

Ok, so the title of this post is about git.
I’m gonna assume you know what that is. It’s mainly used to track versions of software that an individual or team are working on.
It has its frustrations, but it can also be used to publish code on sites like codeberg. You may be more familiar with github (see where the name comes from: git hub) but it’s owned by microsoft who are very bad.

So git is a pain, but only some of the time. There is no simple ‘undo’ command for instance. But if you get stuck, there is usually a good way out on the stackoverflow forum.

Anyway, here is how I use it:

new project

inside a terminal (CLI), type

mkdir newprojectname
cd newprojectname
git init

mkdir means make directory (a folder) and cd means change directory.

see the current overview

git status

or for a quick glance

git status -s

looking at changes

if you want to see all the changes you’ve made

git diff (all of them)
or
git diff filename (one of them)

for json you might want to use
git diff --histogram somefile.json
otherwise diff can get confused.

committing code

git add . (adds everything)
or
git add filename (adds one thing)

git commit -m 'commit message' (commits the code)
or
git commit -am 'commit message' (adds everything and commits in one step)

git push sends it to the remote repo (eg. codeberg)

you will need authentication set up for pushing to work. I’ve been using ssh for this recently, but you can also use a password/email combination if you connect via https. Both are pretty easy once you get going. For ssh you need to generate keys but it’s straightforward and you only need to do it once.

seeing what you’ve done so far

git log

but I use git log --oneline because its easier.

pulling in fresh code from a remote repository

git pull

but if you have stuff in git status that you’re not ready to commit yet, you might want to

git stash before pulling
and
git stash pop after.

there are other more advanced things you can do

like branching and stuff like that.
I use lazygit which is quite helpful for splitting lots of changes into different commits, among other things. But mostly I just use git like above.

If this post was helpful, or if it really wasn’t, let me know via mastodon or email (links in the top bar of this page)

Happy command line-ing!


 updated on: 7 / 11 / 2025

↑ top