You are here

git

How to use Emacs & Org-mode on multiple computers with same settings

I am a big fan of Emacs. I am not saying it is the best editor but I feel it is light weight, yet powerful and it can be customized easily. Of course vi is equally good. It is just a matter of personal taste. I also now rely heavily on Org-mode for storing all my tasks, random thoughts and to-do in org files which is I feel by far the best to-do tool. Calling it a to-do tool is actually understatement. It can do lot more. If you need to remember something with dates, estimates, tracking then org-mode can handle it pretty well. It is fast and super powerful.

The only thing missing is the syncing. If you are like me then working on multiple computers without your tasks in hand could be difficult. Org files are just text files and it is upto you to make it portable and sync with other computers.

Here is what I did to make my org-files portable.

1. I have a folder called c:\emacs that contains the following
.emacs -> init file
emacs.d/ -> folder containing all the modes, .el files
org-mode/ -> folder containing org-files

2. By default if you run emacs it will load the init file from the current user's Home directory, but we want emacs to load init file from c:\emacs\ directory. For this I have written a batch file in windows to change the HOME variable and then load emacs.

set HOME=c:\emacs
C:\softwares\windows\emacs-24.3-bin-i386\emacs-24.3\bin\runemacs.exe %*

3. Now I run this batch file to launch emacs which considers c:\emacs as the home directory.

Neat!

Now I have this folder c:\emacs which I commit and push to Git repository regularly.

But how to sync?

Ideally the commits to happen automatically after every 1 hour or so and changes should be pushed to server regularly too. So I am going to setup the following stuff and also share with everyone.

1. Auto commit files to git.
2. Issue a push on post-commit or may be few times a day using scheduler or cron.
3. Auto pull files on new computer when it is booted up for the first time.

(After implementing I will make these links)

Technically this is not sync in real sense but it is more like making your files portable and available to you as and when you need it.

Duplicating a git repository to another repository - Bitbucket

Duplicating a git repository to another repository - Bitbucket
I always used SVN for managing my projects, that was the case till last year. Though Drupal.org moved to GIT too few years back, I did not completely move to GIT. The main reason was the comfort level. Of course GIT offer plenty of good features but SVN was also not bad, and most importantly I was the only developer on those projects.

Since last year our team has grown and we now use Bitbucket only for managing our code on git repositories. At Sparxsys we offer Drupal development at really competitive prices and our main USP is to deliver fast. Some of the projects have common functionality so we re-use the code of other projects. This may not be true for big complex projects but if we get a requirement for a relatively simple site with standard dynamic features for managing the content, forums, blogs, news, slideshows then we prefer to re-use the code.

For the past 1 year I was mostly involved in managing clients, sales, branding and non-technical activities but since last few weeks I have decided to get involved more deeply in the projects. So my role is now more of developer where I actually build websites, write modules and do lot of designing using Omega4 theme in SASS.

Here I am sharing very simple instructions to duplicate/mirror a git repository.

First create a bare clone of the old GIT repository on your local

git clone --bare https://username@bitbucket.org/username/OLD-PROJECT.git

# Make a bare clone of the repository

You may want to do this in the folder other than your DocumentRoot that contains the folders of your other projects. Just to avoid confusion.

Now move into the directory

cd OLD-PROJECT.git

Push the code into the new repository

Of course you should create this empty repository before running this command.

git push --mirror https://username@bitbucket.org/username/NEW-PROJECT.git

# Mirror-push to the new repository

Finally you may want to delete the old directory

cd ..
rm -rf OLD-PROJECT.git

# Remove our temporary local repository

And it is done. Easy no?

Subscribe to RSS - git