Made by Nathan

programming and projects

Git Shortcuts

| Comments

It seems that for every single git repository I create, I just want to be able to run “git push” and “git pull”. “git pull origin master” just gets annoying after a while. In case I forget how to do this again, this is all it takes (provided you already have an ‘origin’ remote configured):

git config branch.master.remote origin
git config branch.master.merge refs/heads/master

Other useful git shortcut that I literally use everyday (add them to the bottom of ~/.bashrc and then run $ source ~/.bashrc):

alias gst='git status'
alias gca='git commit -am'
alias gc='git commit -m'

So, say I’ve made changes to lots of files and I want to commit them all. I just type:

$ gca "I made a bunch of changes to lots of files"

And if Ive made lots of changes to various files, but only want to commit changes in one file “foo.bar”, I type:

$ git add foo.bar
$ gc "I made a change to foo.bar"

« How to create a favicon.ico with GIMP Don't override core Rails methods »

Comments