Some funny GitHub commits:
What to do if shit happened.
You run “
git add .” and you manage to add 100+ files :( How to “unadd” them with one command?
git reset HEAD --
I found it here. Click on it for a detailed explanation.
The process is nicely explained here: http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository/7244456#7244456 .
I have a Digital Ocean virtual private server (VPS) where I want to run a Python-Flask project of mine. The application works well on localhost, so it’s time to make it public.
However, it’s very likely that I will have to customize it a bit on the server, and thus I would like to get those changes on my localhost too. And vice versa, if I do some changes on localhost, I want to upload the new version to the server too. Copying everything via FTP for instance is out of the question. How to do it then?
Let’s use Git. Bitbucket offers free private repositories, so let’s profit of that :) I want to use that repo similarly to SVN: it’s the central repo, it must contain the latest version.
Let “client A” be the VPS and “client B” my home machine (see the figure). When I modify something on localhost, upload the changes to the central repo, log in to the server and download the latest edition. If I modify something on the server, upload the changes to the central repo, and download them on my localhost. This way the two clients are nicely synchronized.
How to upload?
Upload your local changes to the central repo:
$ git status $ git add -A . $ git commit -m "your commit message" $ git push $ git status
How to download?
Download changes from the central repo (update your local copy):
#!/usr/bin/env bash # git_down_from_central_repo.sh git fetch git pull git status
But… it’s SVN like this!
Works for me :)
You create a Heroku app. but it gets by default a funny name like
whispering-forest-5386.herokuapp.com. How to give it a normal name?
On the Heroku site, navigate to your Dashboard and choose Settings next to your app. There you can give a new name to your app. It will be activated immediately and you won’t be able to reach your app. with the old name.
When trying to push a new version with git, you will get an error. Git is trying to use the old name of your app. Edit the file
.git/config and update the
url by hand.
- Pro Git book (Free, available in HTML. A very nice introduction.)
- Git HQ (official home of Git)
- Learn.GitHub – Introduction To Git (with screencasts)
- A few of my Git tricks, tips and workflows (@reddit)
- Git Reference
- git ready » learn git one commit at a time
- Aha! Moments When Learning Git | BetterExplained
- Bart Trojanowski’s Git tutorial (“Git the basics”, video + PDF, held in July 2008)
- Hogyan használjuk a Git verziókezelő rendszert (in Hungarian)