CyVerse_logo

Home_Icon Learning Center Home

Cloning, Branching, & Versioning

Description:

In this step, you will learn more advanced skills including cloning a repo, the difference between branching and forking, and how to submit and accept pull requests.


Clone a repo

Online

  1. Click the down arrow “Clone or download”
  2. Click “Open in Desktop”
  3. Select where to save it
    • Create a folder for GitHub repos on your computer locally

Commit

Online

  1. Create a file by clicking “Create a new file”
  2. Name file (/name)
  3. Write commit message
  4. Press “Commit”

Desktop

  1. Create a file and put it in your local GitHub repo
  2. Open Desktop
  3. Fetch origin
  4. Write a commit message & hit commit
  5. Push to origin
  6. See changes on the repo online

Tip

fetch & pull origin (see changes you’ve made online)


Version Control

Online

  1. Click on file
  2. Click “History”

Desktop

  1. Go to repository
  2. Go to branch
  3. Go to “Changes”

Revert to Previous Version

Online

  1. Find the commit you want to revert back to
  2. Click on the unique ID (a series of numbers)
  3. Download the zip file

Note

You can add comments to specific changes by putting the mouse on the change and clicking the “+” button

Desktop

  1. Click on history
  2. Right click on the last commit you want to rever to and select “Revert This Commit”
    • this essentially “undoes” the commit made

Create a branch

Online

  1. Select the down arrow on the repository page that says “Branch:master”
  2. Create a new branch name

OR

  1. Add new file or edit existing file.
  2. Write a commit message.
  3. Select “Create a new branch”

Desktop

  1. Fetch & pull origin
  2. Select “Current branch”, make a “New Branch”, “Publish Branch” (you can see that it has been made online)

Pull request

Online

  1. From your branch, create a new file
  2. Commit file to your branch
  3. Hit “Compare & pull request”
  4. Go to pull requests
  5. “Merge pull request”
  6. Delete branch
  7. See it on the master branch

Desktop

  1. Fetch & pull origin
  2. Select “Current branch”, make a “New Branch”, “Publish Branch” (you can see that it has been made online)

OR

  1. Select a branch if one has already been made
  2. Make changes to a file
  3. Write a commit message & commit
  4. Push to origin
  5. “Create a pull request” (takes you back online)

Tip

pull requests are great to get feedback from collaborators before making a change

Note

that you can always revert back to a previous version

Exercise: Why would pull requests be important?


Merge

Online

  1. Go to “Pull requests”
  2. Select down arrow of “Merge pull request”
  3. Merge, Squash, or Rebase OR ignore
  4. Leave comment if need be
  5. Close pull request

Fork

  1. Go to a new repository
  2. Click fork
  3. Save to personal repository.
  4. Clone to Desktop.
  5. Interact via online or in Desktop.
  6. If want to make suggestions, can create a pull request.

Etc.

  • Versioning
    1. Go to “Releases”
    2. Click “Create a new release”
    3. Tag version: Version #
    4. Release title: I usually put the date of the release, but any system can work
  • Notifications:
    • get notified when there is an issue or pull request created
    • can also “watch” a repository and get updates
  • Badges
    1. Go find a badge!
    2. Copy badge code into README:

Fix or improve this documentation

Github Repo Link

Search for an answer: CyVerse Learning Center