Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Monday, September 22, 2008

GIT Repository

GIT is pretty much like a repository to faciliate sharing of work amongst developers (mostly), you need to know this if you are looking at open source development, let me introduce a few commands that may potentially be useful:

1. git clone - this clones the directory of the repository.
e.g. git://scarlet.aura.cs.cmu.edu/openisr.git

2. git push - this pushes the files from your local drive to the central repository (the default is master for the first file) If there are some errors, in regards to non-fast-foward, use the -f option.
e.g. ssh://aarontwc@scarlet.aura.cs.cmu.edu/~aarontwc/openisr.git master

http://davitenio.wordpress.com/2008/10/08/synchronize-git-repositories-between-deskop-and-laptop/

3. git add . - this command adds the existing files in the correct directory to be commited. Basically, it specifies the files to be committed into GIT.

4. git commit -m "message to commit", (instead of just typing git commit, having the -m parameter, allows you to put meaningful text messages to commit, so that its easier for you to track your changes later.

5. git show - this command allow you to see the list of commits make, when and why


6. git pull - this command pulls the latest updates to your local repository.

Kernal.org has a comprehensive guide on GIT.

VIM Editor

An alternative to the EMACs/Nano (my favourite), due to the usage of GIT, (a CVS program), i have to start learning VIM, here are some useful commands to remember.

1. There are different modes in this editor. To get into editing mode, we need to hit "i", (which is the equivalent of insertion. To escape from editing mode after we are done, we need to hit the 'ESC" key which will then bring us to the main prompt.

2. It allows us to do stuffs faster here in he main prompt, for example, by typing "d" on a line, it allows us to remove the entire line.

3. To save, type, "ZZ" (Shift + Z + Z) or use ":x" (Colon + x + ENTER), this qill automatically save and quit. To quit, go outside insertion mode (press ESC), and then type "ZQ" (Shift + Z + Q) or ":q!" (Colon + q + ! + ENTER). The program will quit without saving.

4. To do more complete stuffs like after being able to recover from a lost SSH connection, look under the area of a swap file. When we try to access the file, it will say something like the file already exist. do you want to edit, recover, delete, quit or abort.

Try the following steps to recover the files or do side by side comparion of iles
1. hit "r" when it asked what you want to do (to recover)
2. :sav! /tmp/%
3. :vs
4. :diffthis
5, CTRL + W + I
6. :bp
7. e (to edit anyway)
8. :diffthis (finds the difference between the two files side by side)

Right that should be all you ever need to know about VIM for basic usage.