1

I'm in the magic-status window. I've been hacking away in a git repository for about an hour, now I have a bunch of unstaged files, and "untracked" files.

Whats the quickest/easiest/minimal-keystroke way to "Save these changes"

I'm hoping there would be something like:

Press key "x"
Enter commit message followed by enter

Curious to know how you guys do it...

Drew
  • 29,895
  • 7
  • 74
  • 104
american-ninja-warrior
  • 7,397
  • 11
  • 46
  • 80
  • Personally I never do that, or even want to do that. I review the changes, stage what I want to stage (and/or unstage anything which shouldn't be), and only then commit (all of which Magit makes tremendously easy to do). The closest I come to a blanket "commit all of the things" is if I'm stashing rather than committing (and the stash pop-up has options for including untracked files). – phils Oct 07 '16 at 06:26

1 Answers1

1

The easiest way might be to set up an alias to do what you want.

The problem with that is passing in an argument, as this isn't allowed for a basic text alias.

Instead, you'd have to call git through a shell:

qc = "!sh -c \"git add -A && git commit -m \"$1\"\""

QC stands for quick commit. Then you just call this as follows:

git qc "Added such and such feature"

This currently only takes the first word of the commit message you provide, so I'll leave it as an exercise for you to correctly format the alias as I'm seeing slashes and quotes everywhere I look right now!

Matthew Hallatt
  • 1,310
  • 12
  • 24