Tagged: version_control

Git Basics

I sometimes develop websites for personal interests or for friends. Since I'm the only one to work on them, I did not really pay too much attention on version control. But there was a small project that I worked for my friend, which required me to look into a version control system (because he who has no coding experience also wanted to help updating source codes).

I once tried to learn subversion but couldn't really get the hang of concepts of trunks, branching, etc... So, I didn't want to try subversion. Then I met git.

The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.

Git First-time System Setup:

After installing, execute below commands to set up the system. This is done only one time: $ git config --global user.name "user-name" $ git config --global user.email user@email.com $ git config --global core.editor "gvim -f"

First-time Repository Setup

These steps are necessary each time a new repository is created. First, navigate to the root directory of the website/applicew repository: $ git init Initialized empty Git repository in /home/<username>/www/<project_name>/.git/

By default, Git tracks the changes of all the files, but we can use .gitignore that locates in the application root directory to control what to track. $ vim .gitignore ----------------------------------------- # Ignore bundler config /.bundle # Ignore the default SQLite database. /db/*.sqlite3 # Ignore all logfiles and tempfiles. /log/*.log /tmp # Ignore other unneeded files. doc/ *.swp * ̃ .project

More to come...!