Archive

Posts Tagged ‘git’

funny git commits

February 19, 2017 Leave a comment

Some funny GitHub commits:

Found here.

What to do if shit happened.

Categories: Uncategorized Tags: , , , ,

git: revert “git add .”

September 7, 2016 Leave a comment

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.

Categories: bash Tags: ,

How to update a GitHub forked repository?

Categories: Uncategorized Tags: , , ,

using git like svn

March 15, 2016 Leave a comment

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.

git_like_svn

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.

November 1, 2013 Leave a comment

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.

Categories: Uncategorized Tags: , ,

Git for Windows

January 9, 2013 Leave a comment
Categories: windows Tags: ,

Moving projects to GitHub

March 29, 2011 2 comments

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:

Categories: Uncategorized Tags: ,