Migrating without retaining history

If you are asked to do a migration without retaining history, you can just create a new, empty repository out of sources on your local computer and push existing changes there using the following commands.

Execute the following from the directory that contains the files that should go into the master branch:

git init
git add
git commit -m “Initial import of existing sources”
git remote add https://{organization}@dev.azure.com/{organization}/{teamProject}/_git/{repository}
git push

These commands initialize a new repository, create a first commit out of all of the files already in the directory, add a reference to the target server location, and push the newly created repository there.

If you want to retain multiple branches, you must repeat the following steps for every other branch:

  1. First, go to the right directory for that branch:
Git checkout {branchName}
  1. Now, copy the files that need to go into this branch into your working directory. Then, continue with the following commands:
git add .
git commit
git push

This completes the migration and the latest version of the sources you had on your local computer are now available in Git. Other members of your team can now clone the repository and work with it. Next, we'll go on to learn about branching and merging.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.56.45