Renaming files with case change in a Git Repository

Changing the filename with case change only using the unix command “mv” will not be detected in Git.

The general advice is using the git sub-command “git mv” to rename files, when I type this I saw the below error

It looks like the Mac file system is not case-sensitive, hence the error. The workaround is that, rename the file twice

No complain from Git! Enjoy!

Compiling git from source on CentOS

Prerequisite

You need the Perl libraries in order to compile git, you also need the “gettext” package if you encounter the “msgfmt” error

Download

Go to this page to select the latest git, and download it

https://code.google.com/p/git-core/downloads/list

Installation Steps

There will be an error Continue reading “Compiling git from source on CentOS”

Generate gitignore painlessly with shell command

When using Git as your Version control, when you don’t want some files to be tracked (e.g. runtime data, caches, runtime config), you need to add them to the gitignore file. There’s some list of files needed to be ignored which is common to all projects using a certain CMS/Framework, those are called Boilerplates code. After some time, you’ll find that editing .gitignore config and to remember the last settings you used can be a headache. Luckily there’s some nice people collected those settings for us, just search gitingore in the GitHub. Now you can even use gitignore-boilerplates command line tools to generate one for you.

How to use gitignore-boilerplates

Here is an example on how to bootstrap a WordPress project with gitignore-boilerplates  Continue reading “Generate gitignore painlessly with shell command”

Mirroring Github repos on your own server

We have already discuss why Git is so useful in managing your source code. Now you may also want to use git to check out some interesting projects from other gurus on open source code sharing platforms, e.g. GitHub. Sometimes you may want to mirror the repo on your own server so you and your team can access it from there instead.

A local copy of the foreign repo that is always up-to-date

For example somehow you and your team need to pull the Facebook Android SDK into their workspace, instead of everyone pulling it from Github, you can clone the repo into a local server, and everyone just pull from the local server. This technique can reduce redundant network traffic and is particularly useful if your team don’t have a fast and reliable internet connection, Continue reading “Mirroring Github repos on your own server”

What is Git and how to use Git in your own project?

What is Git?

In short, Git is a free and open-source distributed version control system. If you have used CVS/SVN, they are centralized repositories, in contrast, Git is the “distributed” version. It was created by Linus Torvalds himself as a tool to manage the Kernel. He has a very nice Google Talk about Git, which I recommend you to check it out first. If you have had some experience using SVN, you can easily understand. I’m going to include some summary of the video in this article.

Why Git?

  1. It is distributed, and it is the only right way to do version control (as Linus say so). Well, actually it means every one owns a full copy of the repository and no single repo is more important than the others. Collaboration happens by pulling and pushing code between repos and branches.
  2. Branching is inherent property of development. Continue reading “What is Git and how to use Git in your own project?”