GitHub


GitHub Desktop

Get GitHub Desktop set up to manage your project work. Authenticate to GitHub.com or GitHub Enterprise, keep the app up-to-date, and review your preferred settings.

Installing and configuring GitHub Desktop

Overview

GitHub Desktop is an application that enables you to interact with GitHub using a GUI instead of the command line or a web browser.

Getting started with GitHub Desktop

Learn how to set up, authenticate, and configure GitHub Desktop to allow you to contribute to projects directly from your machine.
  • Installing and authenticating
  • To install GitHub Desktop for MAC and Windows, visit the download page for GitHub Desktop.
  • To install Github Desktop for Ubuntu :
    • Go to github.com/shiftkey/desktop/releases
    • Scroll down to "Assets" and click it to expand and see the downloadables.
    • run the command
    • 
      $ sudo apt install ./GitHubDesktop-linux-2.9.0-linux1.deb    
          		
    • Start the GitHub Desktop then do the authentication
    • Create, add, or clone repositories and use GitHub Desktop to manage contributions to your repositories.
      • You can add a repository from your local computer by selecting the File menu and clicking Add Local Repository...
      • You can clone a repository from GitHub by selecting the File menu and clicking Clone Repository....
  • Collaborating with GitHub Desktop
  • You can use GitHub Desktop to create issues or pull requests to collaborate on projects with other people.
    • Issues help you keep track of ideas and discuss possible changes to projects.
    • Pull requests let you share your proposed changes with others, receive feedback, and merge changes into a project.
  • Keeping your local repository in sync
  • GitHub Desktop can keep your local copy of a project in sync with the remote version by pushing and pulling commits.

Creating your first repository using GitHub Desktop

You can use GitHub Desktop to create and manage a Git repository without using the command line.

Supported operating systems

You can use GitHub Desktop on any supported operating system.

Keyboard shortcuts

You can use keyboard shortcuts in GitHub Desktop.

Launching GitHub Desktop from the command line

Configuring and customizing GitHub Desktop

Contributing and collaborating using GitHub Desktop

Hello World


Step 1. Create a Repository

A repository is usually used to organize a single project. Repositories can contain folders and files, images, videos, spreadsheets, and data sets – anything your project needs.

  • In the upper right corner, next to your avatar or identicon, click + and then select New repository.
  • Name your repository hello-world.
  • Write a short description.
  • Select Initialize this repository with a README.
  • Click Create repository.

Understanding the GitHub flow

Create a Branch


Branching is the way to work on different versions of a repository at one time.

By default your repository has one branch named master which is considered to be the definitive branch. We use branches to experiment and make edits before committing them to master.

When you create a branch off the master branch, you’re making a copy, or snapshot, of master as it was at that point in time. If someone else made changes to the master branch while you were working on your branch, you could pull in those updates.

Use branches for keeping bug fixes and feature work separate from our master (production) branch. When a change is ready, they merge their branch into master.

  • Go to your new repository hello-world.
  • Click the drop down at the top of the file list that says branch: master.
  • Type a branch name in Switch branches/tags, readme-edits, into the new branch text box.
  • Select the blue Create branch box or hit “Enter” on your keyboard.
Now you have two branches, master and readme-edits.

Make and commit changes

  • Click the README.md file.
  • Click the pencil icon in the upper right corner of the file view to edit.
  • In the editor, write a bit about yourself.
  • Write a commit message that describes your changes.
  • Each commit has an associated commit message, which is a description explaining why a particular change was made.
  • Click Commit changes button.
Now, this branch readme-edits contains content that’s different from master.

Open a Pull Request


Pull Requests initiate discussion about your commits.

Pull Requests are the heart of collaboration on GitHub. When you open a pull request, you’re proposing your changes and requesting that someone review and pull in your contribution and merge them into their branch. Pull requests show diffs, or differences, of the content from both branches.

Open a Pull Request for changes to the README:

  • Click the Pull Request tab, then from the Pull Request page, click the green New pull request button.
  • Select the branch you made, readme-edits, to compare with master (the original).
  • Look over your changes in the diffs on the Compare page, make sure they’re what you want to submit.
  • When you’re satisfied that these are the changes you want to submit, click the big green Create Pull Request button.
  • Give your pull request a title and write a brief description of your changes.
  • When you’re done with your message, click Create pull request!

By using GitHub's @mention system in your Pull Request message, you can ask for feedback from specific people or teams.
  • If you're using a Fork & Pull Model
  • Pull Requests provide a way to notify project maintainers about the changes you'd like them to consider.
  • If you're using a Shared Repository Model
  • Pull Requests help start code review and conversation about proposed changes before they're merged into the main branch.

Discuss and review your code

Once a Pull Request has been opened, the person or team reviewing your changes may have questions or comments.
Pull Request comments are written in Markdown, so you can embed images and emoji, use pre-formatted text blocks, and other lightweight formatting.

Deploy

Once your pull request has been reviewed and the branch passes your tests, you can deploy your changes to verify them in production.

This is a final testing in production before merging to main.

Merge your Pull Request

Now that your changes have been verified in production, it is time to merge your code into the main branch.
Once merged, Pull Requests preserve a record of the historical changes to your code.

Merging your readme-edits branch into the master branch.

  • Click the green Merge pull request button to merge the changes into master
  • Click Confirm merge.
  • Go ahead and delete the branch, since its changes have been incorporated, with the Delete branch button in the purple box.

Work on the GitHub remotely


Cloning an Existing Repository



  git clone https://github.com/JerryLeeTaipei/cia.git

留言

熱門文章