DEV Community

Ben Halpern
Ben Halpern Subscriber

Posted on

A day in the life for you and git...

Git is a technology which can be endlessly explained, but sometime demonstrations are best.

What does a typical day look like for you and your relationship with git?

Oldest comments (41)

Collapse
 
jacobherrington profile image
Jacob Herrington (he/him)

I use git constantly. Doing Open Source work a lot and actually having an interest in learning git deeply motivates me to spend a lot of time screwing around with it!

Collapse
 
ashleemboyer profile image
Ashlee (she/her)

I stick to the basics and really only add, commit, and push!

Collapse
 
ben profile image
Ben Halpern

What about branching practices?

Collapse
 
ashleemboyer profile image
Ashlee (she/her)

Ah! I’ve always used feature branches off of master that are small and try to keep them open for only a few days.

Collapse
 
liyasthomas profile image
Liyas Thomas

he always push to master πŸ€“

Collapse
 
raymag profile image
Carlos Magno

Me too, that's 99.9% what I do when I use git

Collapse
 
genreshinobi profile image
ShinobiπŸ•Ή

Add. Commit. Push. Exhale.

Collapse
 
guitarino profile image
Kirill Shestakov

I use VS Code git gui for branching, adding, committing, merge conflicts. I use git command line for rebasing, resetting, looking at logs, reflogs and pushing.

Collapse
 
arbaoui_mehdi profile image
Arbaoui Mehdi

I'm using Tower on Mac, and the git extension of VSCode, my best days of using git is when I'm only pushing into the master branch on my personal projects.

Collapse
 
joshuatz profile image
Joshua Tzucker

Mostly the basics, as others are saying. Add, commit, push, merge. Occasionally I'll have a legitimate reason to use cherry-pick, which always feels fun to use for some reason.

Even when it is just myself working on something, I try to avoid commands that "rewrite history", so I don't get in the habit of using them.

Things I've been trying to do more of lately:

  • Branching
    • Keeps things clean and there is "no cost"
    • Trying to do this more as opposed to stashing
  • Using tags
  • Better commit messages

A neat "trick" I recently learned is how to merge branches without switching to them. Not really needed often, but feels cool to use:

git fetch . {localBranchA}:{localBranchToMergeAInto}

Essentially you're saying fetch . (as an alias for local), get the head / latest commit of {localBranchA}, and then fast-forward {localBranchToMergeAInto} to point to it. See this for details.

Collapse
 
chiangs profile image
Stephen Chiang • Edited

Branch, add, commit, push, pr/merge & delete remote, delete local, repeat.

Collapse
 
s_aitchison profile image
Suzanne Aitchison

We use Bitbucket at work and I normally find myself creating branches there instead of directly in git... Then the usual.. lots of commits and then push to origin

Fairly often find the need for a rebase, occasionally a cherry pick, and when everything goes terribly wrong, a bisect to find where it all went pear shaped πŸ˜‚

Collapse
 
jackharner profile image
Jack Harner πŸš€

Pretty much only add, commit, push, & merge like everyone else has said. I've starting implenting some CI/CD type stuff into my projects so that has me working with Branches a lot more.

Biggest thing I'm really focusing on is writing more useful commit messages. Too many have just been "stuff" "more stuff" and "idk" which isn't a super huge problem when I'm working on stuff myself, but it definitely won't fly when actually working with a team.

Collapse
 
juristr profile image
Juri Strumpflohner • Edited

Hey, I know it's behind a paywall but I'm still gonna mention it. I published a git course a while back on Egghead (egghead.io/courses/productive-git-...). The goal of the course was not to be just another "I'm a git magician" type of course, but rather to show a few IMHO simple git commands that can dramatically improve your dev experience. In fact the course describes pretty much what I'm using on a daily basis and what proved to work (at least in my case).

It's a mixture of

  • creating feature branches
  • committing A LOT on those branches (using --fixup commits to later autosquash)
  • rebasing the branch with the latest master multiple times a day (depending on how much is going on on master meanwhile)
  • preparing my feature branch for PR via interactive rebase + autosquash
  • fast-forwarding it to master once reviewed and ready (to have a linear git history)

Also, using conventional git commit messages for better readability, like

feat(core): ....

build: upgrade version of...

fix(auth): ..