August 4th, 2021

3 Step Versioning Old Projects Into New Repos

Turning this into a post because I can never remember how to do it. Hope it helps someone else as well. A few words of caution, this post does not cover things like security, permissions, or configuration of git, as those are outside the scope for what I wanted to detail in this article.

This example uses .git and Atlassian's BitBucket.

  1. Create a new BitBucket repo (if you've not yet done so) and retrieve the repo's URL, keep it handy.
  2. Initialize and set the remote for your project to the repo's URL by using the following command (remember to change it to your own URL):
    git init
    git remote add origin [email protected]:my-org/my-project.git
  3. Create your first commit to the repo by adding everything, committing it, and then pushing it to the remote:
    git add --all
    git commit -m "init"
    git push -u origin master

That does it! Your project should now be version-controlled. If you find your project is too large for a repo, research strategies on how to incorporate a .gitignore file into your project to ensure you're only versioning the important parts of your project.



Related Articles