.. _instrument.start_version_control: Start software version control ------------------------------ While this step is optional, it is **highly recommended** that you keep your bluesky instrument directory under some form of software version control. At minimum, this can provide some form of backup protection. It also helps others to collaborate with similar bluesky instruments by sharing your instrument's implementations. The installer program initializes a local git repository in the ``bluesky`` folder. We now need to create a blank remote repository, for example on `GitHub `_ or the `APS GitLab server `_ using your :ref:`beamline organization `. Note that the bluesky team recommends GitHub. (Why is that? See section :ref:`git-help` for more info). .. note:: APS beamlines use specific conventions for :ref:`beamline organization `. .. warning:: To simplify the process (avoid merge conflicts), it is important for the remote repository to be **empty**. To do so, carefully follow the instructions described in the tabs below. .. tabs:: .. tab:: GitHub (recommended) Follow the official GitHub instructions `Create a repository `_ with the modifications below: .. raw:: html
  • Do not select "Initialize this repository with a README" (skip step 5)
  • Keep the other options as default:
    • Visibility: Public
    • Repository template: No template
    • .gitignore template: None
    • License: None
.. tab:: GitLab Follow the official GitLab instructions `Create a blank project `_ with the modifications below: .. raw:: html
  • Visibility Level: Public
  • Unselect "Initialize repository with a README"
  • Keep "Enable Static Application Security Testing (SAST)" unselected
The next steps are common to both web-based repositories (GitHub and GitLab): - copy the remote `repository URL `_, for example, ``https://github.com/OWNER/REPOSITORY.git`` - open a terminal .. raw:: html
   $ cd ~/bluesky 
   $ git remote add origin https://github.com/OWNER/REPOSITORY.git  
   # Set a new remote

   $ git remote -v  
   # Verify new remote
   > origin  https://github.com/OWNER/REPOSITORY.git (fetch)
   > origin  https://github.com/OWNER/REPOSITORY.git (push)

   $ git push -u origin main  
   # Push repo to remote
   
For more information, you can refer to the official GitHub documentation: - which URL to use (``ssh`` vs ``https``): `About remote repositories `_ - ``git remote add`` command: `Adding a remote repository `_ - ``git push`` command: `Pushing to a remote repository `_