Alan Coromano
Alan Coromano

Reputation: 26008

Making uploading to github easily for ruby project

I'm working on a Sinatra project alone. Every day or even more often I upload the code to github by saying

git add .
git commit -m "my comment"
git push origin master

I know this question probably is not related to ruby but anyway: how do I make this routine easily? I'd like simply say kind of: "github-commit "my comment" " and nothing else.

Upvotes: 0

Views: 91

Answers (2)

vgoff
vgoff

Reputation: 11313

So that you can be flexible, I would suggest having some short git aliases that you would use.

For instance, to accomplish what you show in your question, perhaps the commands could be as presented here:

gaa
gc "Awesome changes to my code"
gpm

It would be less typing, 8 characters minus the comment string as compared to your github-commit command, and yet still flexible. And I based the commands on the mnemonic 'git add all' and 'git commit' and 'git push master'

You can define aliases in your .bashrc, for example, by following this pattern:

alias gpp='git pull --rebase && git push'

Though you will likely need a shell function for accepting an argument for your gc functionality, or be presented with an editor (my preference) to place your commit comments in.

Upvotes: 0

vdaubry
vdaubry

Reputation: 11439

Write a .sh script ?

Something like this :

#push.sh
git add .
git commit -m $1
git push origin master

Then you can do push.sh "your commit message"

(just to give you an idea, not tested)

Upvotes: 1

Related Questions