Git


Because I can never remember how to do this, instructions on how to add an existing project to source control using Git.

  1. Create new repository using Github web interface
  2. cd to project directory
  3. >git init
  4. >git add .
  5. >git pull <repos> master
  6. >git commit -a -m “initial checkin”
  7. >git remote add origin <repos>
  8. >git push origin master

I don’t recall doing #5 the last time, but it was required this time…

 

 

I recently converted from SVN to Git and needed to break my legacy SVN repositories into separate git repositories. This turned out to be much harder than I thought.  After a lot of googling and much trial and error, here’s the process I settled on:

  1.  Create new remote repository new-repo
  2. Clone new-repo locally
  3. Execute command line:

    > cd new-repo
    > git remote add old-repo https://github.com/cyberreefguru/old-repo.git
    > git pull https://github.com/cyberreefguru/old-repo.git master
    > git rm -r old-folders
    > git mv files-around-as-necessary
    > git commit
    > git push

Hope it helps someone.