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
- Click the down arrow “Clone or download”
- Click “Open in Desktop”
- Select where to save it
- Create a folder for GitHub repos on your computer locally
Commit¶
Online
- Create a file by clicking “Create a new file”
- Name file (/name)
- Write commit message
- Press “Commit”
Desktop
- Create a file and put it in your local GitHub repo
- Open Desktop
- Fetch origin
- Write a commit message & hit commit
- Push to origin
- See changes on the repo online
Tip
fetch & pull origin (see changes you’ve made online)
Version Control¶
Online
- Click on file
- Click “History”
Desktop
- Go to repository
- Go to branch
- Go to “Changes”
Revert to Previous Version¶
Online
- Find the commit you want to revert back to
- Click on the unique ID (a series of numbers)
- Download the zip file
Note
You can add comments to specific changes by putting the mouse on the change and clicking the “+” button
Desktop
- Click on history
- 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
- Select the down arrow on the repository page that says “Branch:master”
- Create a new branch name
OR
- Add new file or edit existing file.
- Write a commit message.
- Select “Create a new branch”
Desktop
- Fetch & pull origin
- Select “Current branch”, make a “New Branch”, “Publish Branch” (you can see that it has been made online)
Pull request¶
Online
- From your branch, create a new file
- Commit file to your branch
- Hit “Compare & pull request”
- Go to pull requests
- “Merge pull request”
- Delete branch
- See it on the master branch
Desktop
- Fetch & pull origin
- Select “Current branch”, make a “New Branch”, “Publish Branch” (you can see that it has been made online)
OR
- Select a branch if one has already been made
- Make changes to a file
- Write a commit message & commit
- Push to origin
- “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
- Go to “Pull requests”
- Select down arrow of “Merge pull request”
- Merge, Squash, or Rebase OR ignore
- Leave comment if need be
- Close pull request
Fork¶
- Go to a new repository
- Click fork
- Save to personal repository.
- Clone to Desktop.
- Interact via online or in Desktop.
- If want to make suggestions, can create a pull request.
Etc.¶
- Versioning
- Go to “Releases”
- Click “Create a new release”
- Tag version: Version #
- 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
- Go find a badge!
- Copy badge code into README:
Fix or improve this documentation
Search for an answer: CyVerse Learning Center