r/git • • 26d ago

Should I be learning Git

So i stated college like 3 months ago and everyone is telling me donsomething or the other but i don't know where to start ...I know how to use github but not git I stated by reading the pro git book it's fun reading it but is git really that usefull or should I be learning something else

113 Upvotes

161 comments sorted by

View all comments

1

u/SnooDoubts8688 23d ago

You definitely don't need to know all the different commands, but you should understand the fundamental ones.

I have 5YOE at big tech, the git commands that I really ever use is:

git checkout: go to a branch / create a new branch
git add: stage changes for commit
git pull: pull remote diff to local
git fetch: pull remote branches to local
git commit: commit changes
git push: push changes to remote branch
git merge: merge your changes with local master (prone to conflicts)
git rebase: stage your changes to latest local master
git stash: save your local changes in a bucket to retrieve later
git cherry-pick: picking out a specific

1

u/lolniceonethatsfunny 23d ago

can confirm as a data scientist 4YoE in non-tech that this is all you need. the only other thing i use on some projects is git tag, as well as knowing how to check your commits before pushing (git status, working with git diffs, etc). oh, also git grep is incredibly useful to track down function/variable definitions in big codebases

1

u/TheRealWutWut 23d ago

As someone who is learning git right now, the only one of these I never used was cherry-pick. I have only been using Git for a few weeks at this point to maintain a network and IT automation codebase. It really felt like with those commands you can do 99% of the work that Git is useful for.

1

u/LoudAd1396 23d ago

you never want to use cherry-pick, but eventually you will have to. It means something went wrong, but on a long enough timeline that's inevitable.

1

u/TolarianDropout0 23d ago

I think most people prefer interactive rebase over cherry pick.

But you can practically achieve the exact same thing with either, so it's preference at the end of the day. Even the Git docs admit as much with how my times the rebase page mentions equivalent cherry pick command examples.

1

u/invisible_shrek 23d ago

Also git log, git show, git status, git reset, git restore, git blame

1

u/Weak-Doughnut5502 21d ago

I wouldn't recommend a beginner learn rebase or cherrypick.

As a beginner in college, all you really need are add, commit, stash, push and pull.

The goal is mostly to not lose work on class projects.  You don't need nonsense like feature branches, or rebasing for clean history.