Eric Using Git

From Lift

Jump to: navigation, search

As a Windows user, I started downloading msysGit which I had no issue with. During the installation I specified that I wanted the Git bash shortcut available when right-clicking on a folder.

My first use case for git was to create a branch for the Helpers refactoring and specification and commit my previous work on it.

This is how I did it:

Get the repository and create a new branch

1. git clone git://github.com/dpp/liftweb.git # "import" the git repository to my laptop
2. git checkout -b helpers_specs # to create a new branch and switch to that branch
3. git branch # check that I am indeed on that branch

Work on the branch

4. copy my files
5. git status # to see the current modifications
6. git add file-name  # I added the new files manually
7. git commit -a -m "created a new helpers_specs branch to work on helpers"

Prepare for a secure push Create and Register a public key on github

--> Not doing this will result in a message like: "The remote end hung up unexpectedly" when trying to push modifications

8. generate a public key with puttygen (I had an existing key)
9. add the public key to my Account in Github

Enable the use of my public key

10. cd ~/.ssh
11. exec ssh-agent bash
12. ssh-add id_rsa

--> Not doing this will result in messages like: "Could not open a connection to your authentication agent" when trying to push modifications

Pushing my modifications

13. git config user.name etorreborre # I forgot to do this at first so I had "unknown author" on github for my commits
14. git config user.email etorreborre@yahoo.com # put your own address here

--> you may want to use git config --global to set those variables for all your projects by default

15. git remote add liftweb git@github.com:dpp/liftweb.git # to create an alias for the lift repo on github
16. git push liftweb helpers_specs

And now, if I want to start "fresh" I can do:

1. git clone git://github.com/dpp/liftweb.git # get the repository
2. git remote add liftweb git@github.com:dpp/liftweb.git # declare a nice alias
3. git branch -a # check the existing branches
4. git checkout -b helpers_specs origin/helpers_specs # checkout the remote branch I want to work on locally
5. work, work, work
6. git add --interactive  # I discovered the interactive command to precisely select what I want to include in my commits
   [a]dd
   [u]pdate
7. git commit -a -m "appropriate message"
8. git push liftweb helpers_specs # push my developments to other developers
Personal tools