Software Carpentry
“Software Carpentry is a community of volunteer instructors who teach short workshops and develop lessons which empower researchers of all disciplines to learn about and improve the ways in which they create software and collaborate.” (source)
I found them today: https://github.com/swcarpentry/swcarpentry . Looks good!
funny git commits
git: revert “git add .”
Problem
You run “git add .
” and you manage to add 100+ files :( How to “unadd” them with one command?
Solution
git reset HEAD --
I found it here. Click on it for a detailed explanation.
How to update a GitHub forked repository?
The process is nicely explained here: http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository/7244456#7244456 .
using git like svn
Problem
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?
Solution
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 :)
Renaming your Heroku app.
Problem
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?
Solution
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.
Moving projects to GitHub
A few days ago I decided to learn Git. This is something that I’ve had in my mind for a long time. Also, I will move my projects to GitHub (here is my profile page).
Useful links
Start with:
- Pro Git book (Free, available in HTML. A very nice introduction.)
Read on:
- 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)
You must be logged in to post a comment.