Janis Lesinskis' Blog

Assorted ramblings

  • All entries
  • About me
  • Projects
  • Economics
  • Misc
  • Software-engineering
  • Sports

A handy git command


This blog is made with a static site generator and all the content is stored in a Git repository.

When I'm working on this blog I often make edits across a number of devices. These edits are really in a linear history but when I sync the edits across different devices I can sometimes have conflicts. One way to deal with this is to use git pull and just have a merge commit, but I find this makes the history more messy than it needs to be. If the commits are arranged in order of the time they were written then there's a lot of merge commits needed. I really only care about applying changes and keeping everything in sync in this case since I'm not using branches for content.

There's a useful command git pull --rebase that will allow you to take the remote changes then apply your local changes on top of the remote changes via a rebase. This helps keeps the history nice and linear while integrating the changes. The reason I like this is because I'm not really merging changes when I'm working on my blog, it's more a way of keeping different devices in sync, the actual history of the site in terms of the published commits is the only thing I really care about and managing my repo in a way that makes the history in Git less complicated is my goal.

Published: Sat 11 July 2020
By Janis Lesinskis
In Software-engineering
Tags: git version-control

links

  • JaggedVerge

social

  • My GitHub page
  • LinkedIn

Proudly powered by Pelican, which takes great advantage of Python.