About Git and GitHub

Source: Internet
Author: User

English Original: Ten things you didn ' t Know Git and GitHub Could do

Both Git and GitHub are very powerful tools. Even if you have been using them for a long time, you will probably not know every detail. I've sorted out 10 common techniques that Git and GitHub can use to improve their daily productivity.

  GitHub

  Shortcut keys: T and W

In your source browsing page, press t to quickly enter the fuzzy file name search mode:

On your warehouse homepage, press w to quickly branch-filter:

On any GitHub page, press ? the shortcut key that shows the current page available:

  Ignore spaces:? w=1

Add in any diff URL ? w=1 is used to organize indents:

  Filter submissions by scope: [Email protected]{time}. Master

You can create a comparison page by using the URL github.com/user/repo/compare/{range} . The range (range) can be two SHA for example sha1…sha2 or two branch names for example master…my-branch . The range is also very intelligent to support the use of time as a concern. You can [email protected]{1.day.ago}…master filter the submissions from yesterday onwards. For example: links that https://github.com/rails/rails/compare/[email protected]{1.day.ago}…master show all submissions and changes from the Rails project that started yesterday:

  Filter submission records by author:? Author=github_handle

You can filter submissions by author by adding them in the URL of the Compare page ?author=github_handle . For example, https://github.com/dynjs/dynjs/commits/master?author=jingweno the link shows the commit record of Jingweno to DYNJS:

  . diff and. Patch

Add .diff or .patch get a diff or patch text format after the URL of the Compare page, merge request page, or comment page. For example, the link https://github.com/rails/rails/compare/[email protected]{1.day.ago}…master.patch shows all of the submission records and changes in the text format of the Rails project that started yesterday:

  Email reply

You can comment directly on the GITHUB notification email you received, without having to comment on the site page. GitHub will handle your comments correctly:

  Link line

In the File Display page, click on a row or by pressing the SHIFT selection of multiple lines, the URL will be changed accordingly. It's very handy if you want to share a piece of code with your teammates:

  Follow users

In a merge request, a question, or any comment, the user is concerned about all subsequent notifications:

  Auto Link

In a merge request, issue, or any comment, sha and the problem code (for example: #1) are automatically linked. Also, you can link to other warehouses of Sha or problem code, format: user/[email protected] or user/repo#1 . Here is an example of an automatic link through Sha in a comment:

  Hub

Hub is the command line for GitHub. It provides the integration between Git and Github. One of the most useful commands is to create a pull request at the command line hub pull-request . See the README.

  Git

  Git log-p FILE

View README.md The revision history, for example:

> Git log-p readme.md

  Git log-s ' PATTERN '

For example, the search modifies stupid the history that matches:

> Git log-s ' stupid '

  Git add-p

Interactive save and cancel save changes, using:

> Git add-p

  Git rm–cached FILE

This command only deletes remote files, for example:

> Git rm--cached database.yml

Deletes database.yml the saved record, but does not affect the local file. This is very convenient for deleting ignored file records that have been pushed and does not affect local files.

  git log. BRANCH

This command returns the commit record for a non-HEAD branch. If you are in a functional branch, enter:

> Git log. Master

Returns the history of all master branches, including commit records that have not been merged into the current branch.

  Git branch–merged & git branch–no-merged

This command returns a list of merged branches or branches that have not been merged. This command is useful for pre-merger checks. For example, in a feature branch, enter

> Git branch--no-merged

Returns a list of branches that have not been merged into the branch.

  Git branch–contains SHA

Returns a list of branches that contain a specified SHA. For example:

> Git branch--contains 2f8e2b

Displays all 2f832b branches that contain commits. This command git cherry-pick is very helpful for verification completion.

  Git status-s

Returns a simple version of Git status. I set this command as the default git status to reduce the noise.

  Git reflog

Displays a list of actions you have completed locally.

  Git shortlog-sn

Displays a list of participants who submitted the record. Same as the GitHub participant list.

  Summary

Git is a well-designed tool. Knowing it can directly make you more efficient and become a more talented programmer. GitHub, on the other side, provides a convenient team feature on a Git basis. Having the ability to use GitHub can also improve your daily productivity.

To better deepen your understanding of Git and Github, I recommend some information:

    • Progit, the best Git Guide
    • Advanced Git
    • Git and GitHub Secrets

from:http://news.cnblogs.com/n/530478/

About Git and GitHub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.