dkellner dkellner - 1 month ago 5x
Git Question

Is there a REALLY simple way to use git - like one single command?

What I mean is:

  • We have a server that stores the latest version,

  • During my day, sometimes I want to commit my changes,

  • After I committed all I've done, I want to get in sync with others,

  • If no problems occured, I want to get back to work with no extra steps.

In a dreamworld, this should be done with just one command, like "git snap" and it should manage all the steps; of course when something goes wrong (a conflict that can't be auto-resolved) it would give me an error message and I'd start doing it the hard way. (Yes I can do it, I'm using git every day, just want to make it effortless.)

So, what's the simplest way to achieve this? A batch, perhaps? A series of git commands like stash + pull + stashpop + commit, or commit + pull + push? Is there an automatic way to do this, in the optimist case when no bad conflicts happen?

I'm using git with 3 different clients now (SourceTree, GitExtensions, TortoiseGIT) but neither makes my life that simple. I don't want to stash manually all the time, I'm not interested in the detailed messages, just one command and it's either all done OR failed for a reason.

Is there a way?


The only option I can think of is a bash function or script to run the commands in series. My workflow would look like this (since you don't care about commit message):

git commit -a --allow-empty-message -m ''
git pull --rebase
git push

For me, this would capture probably 80% (SWAG) of my workflow. The git pull --rebase is the only step likely to fail. It will fail if there are any conflicts, but leave you in a position to correct then, then continue the rebase with git rebase --continue. From here, you would then git push to complete the workflow.

You might also look into GitHub's own Git client, it's quite simple and integrates well. However, it won't give you the "one click operation" you are searching for.