Git is by far the most popular software version control system today, and every software developer surely knows the basics of how to make a git commit. Given the popularity, it is surprising how many people don’t actually know the advanced commands. Mastering them might help you unlock a new level of productivity. Let’s dive in!

As aliases

alias g-log="git log --graph --format='format:%C(yellow)%h%C(reset) %s %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)'"
alias g-history='gitk --all &'
alias g-checkout='git checkout $(git branch --sort=-committerdate --no-merged | fzf)'
alias g-commit='git citool &'
alias g-amend='git citool --amend &'
alias g-rebase='git rebase --interactive --autosquash'
alias g-pull='git pull --verbose --rebase'
alias g-pushf='git push --verbose --force-with-lease'
alias g-status='git status --ignored'
alias g-clean='git clean -fdx && git reset --hard && git submodule foreach --recursive git clean -fdx && git submodule foreach --recursive git reset --hard'

I’m gonna be completely honest. I don’t truly get all the inner working of git. I’m a senior DevOps Engineer and been using git for a decade, but is git is simular to sed or awk for me. I know how to do what I want really well but when shit goes wrong, I’m flying by the seat of my pants.

A lot of times, I just know what to do to fix things because it’s rote memory with substitutions. But if you needed me to explain upstreams and rebases in actual detail, I’d be in trouble. But it rarely becomes an actual problem to the level where I’ll dedicate time to learning all the advanced stuff.

That said, I’ve learnt that most senior people also just pretend they get it all but instead are just relying on rote memorization and basic concepts. Anyone else here in the same camp of being a fraud with git?

Anytime I’m about to get fancy with git I have to stop and remember that I’m an idiot and am probably not doing something else right.

Otto
creator
link
fedilink
47M

I had the same feeling until I started using gitk. I always have a gitk window open and press F5 to reload, so it shows me the state of everything after I’ve run git commands. Now I grasp everything much better.

The fact that you have to kind of understand how git works under the hood to really unlock its full potential is a definite design flaw of the tool, but given its ubiquitous use in our industry, I encourage you to check out how git works under the hood. Once you learn the underlying concepts, you reach a whole new level of proficiency with git, no longer having to just get by, and instead you get to thrive.

Create a post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1.11K users / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog