Git: remove all deleted files

I made a major refactoring that caused to move many files. Git tracks automatically those moves, but the new files have to be added and the old removed with git rm.

However the list of deleted files shown by git status was a bit long, so I thought about “Everybody stand back. I know regular . . . → Read More: Git: remove all deleted files

Installing gitolite on a server

After experimenting on github.com, experimenting with my local laptop, it’s time to go live and install gitolite on one of my servers. First I copy my public key to the future git server:

$ scp .ssh/id_dsa.pub ubuntu@git.example.com:/tmp

Next I install gitolite on git.example.com, with admin privileges.

$ sudo git clone https://github.com/sitaramc/gitolite.git $ cd gitolite $ . . . → Read More: Installing gitolite on a server

Git, forking and still collaborate

I’ve created two “remote” repositories (on localhost) for this test: stivlo/sandbox and john/sandbox. I can read and write both repo and John can only read mine to get the updates.

I’ve already a small local Git repository in stivlo-sandbox, with remote origin pointing to stivlo/sandbox on localhost.

john/sandbox is now empty and I want . . . → Read More: Git, forking and still collaborate

Migrating a SVN repository to Git

I wanted to import from SVN to my Git private repository. I’ve followed the tutorial provided by github.com.

However I had to remove the -s switch from the command line or the import wouldn’t work.

git-svn clone –no-metadata http://svn.example.com

This will create a local Git repository, with all SVN history, to which I can add . . . → Read More: Migrating a SVN repository to Git

git push and pull default destinations

Here is an example to attach a default remote to push

$ git push No refs in common and none specified; doing nothing. Perhaps you should specify a branch such as ‘master’. fatal: The remote end hung up unexpectedly error: failed to push some refs to ‘git@localhost:stivlo-repo’ $ git push origin master Counting objects: 3, . . . → Read More: git push and pull default destinations

Playing with Git Remotes

I start with a cloned repository from github.com

$ git remote -v origin git@github.com:stivlo/HeadFirstDesignPatterns.git (fetch) origin git@github.com:stivlo/HeadFirstDesignPatterns.git (push)

I add a new remote from my local gitolite installation and fetch from there (but it’s empty)

$ git remote add stivlo-repo git@localhost:stivlo-repo.git $ git fetch stivlo-repo

Now I add a new remote from github.com, my . . . → Read More: Playing with Git Remotes

Git branches

To create a new branch called self-tracing-methods, I call the git branch command. It shows that the new branch is created, but I’m still on branch master. It takes a branch checkout with the branch name to switch to the new branch.

$ git branch self-tracing-methods $ git branch * master self-tracing-methods $ git checkout . . . → Read More: Git branches

Installing a git server on my local laptop

I’ve chosen to install gitolite with the root method explained in the gitolite installation document.

This first test installation is on my Linux laptop, for the purpose of experimenting.

As my user stivlo, I send my ssh public key to the server, in this case I can just copy it to tmp and pick it . . . → Read More: Installing a git server on my local laptop

Renaming a project in github

git and github make surprisingly easy and painless to rename your project, so easy that I’m a little bit ashamed to blog about it. But here we go.

In your github administration, from the Dashboard, click on the repository that you want to rename, then click on the Admin button on the top, the first . . . → Read More: Renaming a project in github

Some notes on how I pushed my first project to github

First I went to the project directory and issued the following commands

git init git add pom.xml git add src/main/java/org/obliquid/helpers/*.java git add src/test/java/org/obliquid/helpers/*.java git remote add origin git@github.com:stivlo/org.obliquid.helpers.git git status

Then I’ve created a .gitignore file with the following contents:

.classpath .project target/

And issued more commands

git add .gitignore git commit git push -u . . . → Read More: Some notes on how I pushed my first project to github