The blog ofJonathan Pepin

My Git personal journal


how git works

remove a file

$ git rm /file/path

Deletes the file and removes it from the git tracking at the same time.

add all the removed files

$ git add -u

Add all deleted files at once instead of doing git rm /file/name for each file


$ git commit --amend

Insert a forgotten change to the last commit, so you don't have to make a new commit for a quick addition.


rename a branch

$ git branch -m oldname newname

push to origin. (will create the remote branch if it doesn't already exist)

$ git push origin branchname

Remote actions

get info on all locals and remote branches

git remote show origin


$ git rebase origin/master

Like pull but puts local commits on the side for the update, then merge the local commits, making merges conflicts about the addition of the local changes, versus the addition of origin's changes on top of local.

$ git rebase -i

Allows to merge multiple commits in one, so you make cleaner pushes to origin and keep a clean local logs.

$ git rebase -i <commit>
$ pick -> e commit
// do modifications
$ git add .
$ git commit --amend
$ git rebase --continue

Allows to make modification to a previous commit

Push to staging

after having rebased origin/branchname of course

git push -f staging head:master

*staging is the name of the app on heroku
*head is the branch you're on
*master is the branch you wanna push onto

get logs from staging

heroku logs --tail --remote staging

*--tail means live stream of logs
*--remore is where the app is
*staging is the name of the app