Here’s a good online tutorial for learning GIT
What you may miss off-the-bat is that Heroku’s copy of your app is actually a git repository. It’s like github’s repository of your code, but it is used for the special purpose of deploying the app.
When you do a deploy to Heroku, you are pushing only your latest commits to the master branch of the Heroku repository for your app.
Type more .git/config at the command line of one of your apps, you will see a git remote for the heroku repository
url = firstname.lastname@example.org:abc-app.git
fetch = +refs/heads/*:refs/remotes/heroku/*
In my case, the name of my heroku app is abc-app (made up) but I’ve attached it to a git identifier (just something I type at the command line) called heroku_abc_app
To deploy this app, I would use:
This is saying I want to put my local master branch (the first “master”) to the master branch of the remote repository (the second “master” after the colon) to the repository which is identified by heroku_abc_app (defined in .git/config), in my case that repository happens to be at email@example.com:abc-app.git
You can also push a different branch to Heroku, like this
This is saying you want to push some_branch onto the master branch of your your app. Be careful – if you push a branch and then try to push another branch (or master) onto a non-downstream git timeline, you will get rejected. You can easily fix this with --force at the end of your command.
Although Heroku’s git repository acts just like a real git repository, most of us use github as the authoritative source for our app’s code and the Heroku git setup only for deploying.
I recently had to re-set my git repo, and after I did every time I did git pull or git push I was asked to re-enter my password.
Turns out this is what happens when you clone your repository using the https syntax and not the git@ syntax.
Create a file in your home directory here:
(The dot makes it invisible of course)
In this file, you can configure lots of git stuff:
email = firstname.lastname@example.org
name = John Doe
rename = copy
# Always enable color, in all commands
ui = true
And if you want some handy aliases for typing less when using git, try these:
ba = branch -a
st = status
ca = commit -a -v
ci = commit -v
pl = pull –rebase
pu = push
cmp = gc –aggressive