HomeFontsAbout

git

Updated on 2021-11-13

For solo work, I want undo history, remote backup and the ability to share my code with the public (currently sourcehut).

To achieve this, I created a single git alias, sync, to be used for all of my committing, pushing and pulling needs. All I do is type git sync and I am all synced up 😎.

sync = "!git add --all; git commit -m \"$(git status --porcelain)\"; git pull --rebase; git push origin master;"

That is a bit hard to read, so let me expand.

git add --all
git commit -m "$(git status --porcelain)"
git pull --rebase
git push origin master

In English, the alias does the following four steps.

  1. stage all files
  2. create commit message based on changes
  3. pull remote changes from origin
  4. push local changes to origin.

Copyright © 2020-2021 thestuffido.xyz All Rights Reserved