4 ms·
I'm a "senior" dev and here's my git skillset: git clone [repo] (download existing project) git init (start a new project) git checkout -b [branchname]
by b212 6y ago
I'm a "senior" dev and here's my git skillset:
git clone [repo] (download existing project)
git init (start a new project)
git checkout -b [branchname] (create a new branch)
git checkout [branchname] (jump between branches)
git checkout -- [filename] (reset changes in given file)
git reset --hard (reset evertyhing)
git clean -f -d (remove leftovers after reset --hard)
git status (see changed files)
git diff (see changed lines)
git add ./[filename] (prepare file(s) for saving)
git commit -m [commitname] (save changes)
git push origin [branchname] (push changes to remote server)
git merge [branch] (merge two branches)
I've been using these commands exclusively for the last 12 years or so. These are the ones I know by heart. If I was able to get by only using these than it's likely you could also survive knowing nothing more.
Rebase is still confusing at times. I did cherrypicking multiple times, but usually Google that just to be sure.
Squashed a few times, but this I also Google.
Reverted a commit a few times too, Googled.
Changing commit message and unstaging is more common, but still do it so rarely I have to Google it as there's no point in memorising (one day might finally remember them, right now I know it's reset soft and amend, not sure about syntax).
I do not use git pop and git stash because microcommiting is better and less confusing and leaves no trash behind (just my opinion, might be wrong).
Maybe I've missed something but if you're taking it slow and do not make any serious fuckups with git it's all about add/commit/push, 99% of the time. I know I might seem lame to most of you as there are more git ninjas on HN than anywhere else, but I honestly just did not need any other commands and I've been working for companies as big as 500 devs.
It's a whole different story once you do something wrong, my strategy is to think 10x about everything I type after 'git' and never had any issues, but when they happen - I just Google again. Worked every time, so far. I feel although I know shit about git I'm pretty confident using it, I've seen many mid devs who still have trouble with mental models of merging stuff, people merging "dev" branch to feature branches etc. is something that happens to other folks quite often.
To sum things up - I think git is extremely hard if you want to use it from top of your head to fix complicated and not that common issues. If you just want to use it, survive and not necessarily understand all the mechanics behind it - it's as easy as HTML.
I sympathise with the article, though I'm not sure git is to blame here - if you have to revert a branch from remote once in 2 years there's no way you're going to remember how to do that. Without UI you will need to search for the solution every time, and it does not matter what command line tool or version-control system you use.
- Cloudef 6y agoinit, clone, add, commit, push, fetch, reset, checkout, status, diff, rebase and cherry-pick are all you need pretty much. I never use merge or pull. Interactive rebase is the most useful git command.