How to merge the code from the GIT code library into your own git/GitHub learning notes to summarize your common git commands

Source: Internet
Author: User
Tags git commands

GitHub for Windows usageArticleIt is good to take us to get started with GitHub and a gitshell. This tool can run all the commands of GitHub to do more things, for example, how to merge git is a task we want to complete today?CodeCode from the library to your own library.

Windows powershell
Copyright (c) 2012 Microsoft Corporation. All rights reserved.

C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git branch- # View all branches
* Master
Remotes/ORIGIN/head-> origin/Master
Remotes/ORIGIN/Master
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git remote add coretea
M git: // github.com/ghorsey/sharpoauth2.git # Add the Master Project address to keep up with updates
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git fetch coreteam
Remote: counting objects: 297, done. # Obtain master project updates
Remote: compressing objects: 100% (108/108), done.
Remote: Total 227 (delta 147), reused 165 (delta 85) sorting ing objects: 73% (166
Grouping objects: 74% (168/227), 60.00 kib | 10 kib/s
Grouping objects: 100% (227/227), 74.24 kib | 10 kib/s, done.
Resolving deltas: 100% (147/147), completed with 48 local objects.
From git: // github.com/ghorsey/sharpoau2
* [New branch] Master-> coreteam/Master

# Create a main project as your own branch
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git checkout-B coreteam/Master
Branch coreteam set up to track remote branch master from coreteam.
Switched to a new branch 'coreteam'
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ coreteam]> git branch-
* Coreteam
Master
Remotes/coreteam/Master
Remotes/ORIGIN/head-> origin/Master
Remotes/ORIGIN/Master

# Now you can track the latest updates and merge them into your own branch

# Switch to the master Branch
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ coreteam]> git checkout master
Switched to branch 'master'

Merge coreteam/master to the local master Branch

C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git merge coreteam/Master
Auto-merging readme. md
Merge made by the 'record' strategy.
Readme => readme. md | 30 +-
.../Provider/MVC/sharpoauth2.provider. MVC. dll | bin 5120-> 5120 bytes
.../Provider/MVC/sharpoauth2.provider. MVC. PDB | bin 11776-> 11776 bytes
... H2.provider. resourceauthorizationhttpmodule. dll | bin 8704-> 8704 bytes
... H2.provider. resourceauthorizationhttpmodule. PDB | bin 17920-> 17920 bytes
Code/deploy/provider/sharpoauth2.framework. dll | bin 9216-> 9216 bytes
Code/deploy/provider/sharpoauth2.framework. PDB | bin 11776-> 11776 bytes
.../Sharpoauth2.provider. Globalization. dll | bin 13312-> 13312 bytes
.../Sharpoauth2.provider. Globalization. PDB | bin 28160-> 28160 bytes
Code/deploy/provider/sharpoauth2.provider. dll | bin 36352-> 37888 bytes
Code/deploy/provider/sharpoauth2.provider. PDB | bin 130560-> 136704 bytes

Code/src/restsample/properties/assemblyinfo. CS | 4 +-
Code/src/sharpoauth2.client/accesstoken. CS | 1 +
.../Sharpoauth2.client/properties/assemblyinfo. CS | 4 +-
.../Properties/assemblyinfo. CS | 4 +-
Code/src/sharpoauth2.framework/itoken. CS | 2 +-
.../Properties/assemblyinfo. CS | 4 +-
.../Properties/assemblyinfo. CS | 4 +-
.../Src/sharpoauth2.mvc/properties/assemblyinfo. CS | 4 +-
.../Oauthauthorizemodule. CS | 7 +-
.../Properties/assemblyinfo. CS | 4 +-
.../Properties/assemblyinfo. CS | 4 +-
.../Sharpoauth2.tests/properties/assemblyinfo. CS | 4 +-
.../Authorizationprovidertests. CS | 364 ++ -----------
.../Processor/implicitflowprocessortests. CS | 2 +-
.../Resourceendpoint/resourceprovidertests. CS | 2 +-
.../Processors/authenticationcodeprocessortests. CS | 4 +-
.../Authorizationendpoint/authorizationcontext. CS | 2 +-
.../Authorizationendpoint/iauthorizationcontext. CS | 2 +-
.../Processor/authorizationcodeprocessor. CS | 2 +-
.../Processor/implicitflowprocessor. CS | 2 +-
Code/src/sharpoau2/ domain/accesstokenbase. CS | 93 ++ ---
.../Sharpoau2/ domain/authorizationgrantbase. CS | 24 +-
Code/src/sharpoau2/ domain/iauthorizationgrant. CS | 12 +
.../FLUENT/fluentauthorizationcontext. CS | 188 ++ ------
Code/src/sharpoau2/ FLUENT/fluenttokencontext. CS | 146 ++ -----
Code/src/sharpoau2/ framework/errorresponse. CS | 22 ++
Code/src/sharpoau2/ properties/assemblyinfo. CS | 8 +-
.../Resourceendpoint/processors/bearerprocessor. CS | 2 +-
.../Resourceendpoint/resourcecontext. CS | 52 ++
.../Resourceendpoint/resourceprovider. CS | 73 ++ --
.../Services/iauthorizationgrantservice. CS | 16 +-
Code/src/sharpoau2/ services/itokenservice. CS | 22 +-
Code/src/sharpoau2/ sharpoauth2.provider. csproj | 1 +
.../Processor/authenticationcodeprocessor. CS | 44 + --
.../Authorizationgrant. CS | 3 +-
.../Properties/assemblyinfo. CS | 4 +-
.../Service/authorizationgrantservice. CS | 96 ++ ---
.../Service/clientservice. CS | 108 ++ ---
.../Service/tokenservice. CS | 178 ++ -----
Code/src/clean. PyC | bin 1351-> 1360 bytes
51 files changed, 838 insertions (+), 710 deletions (-)
Rename readme = & gt; readme. MD (73%)
Create mode 100644 code/src/sharpoau2/ domain/iauthorizationgrant. CS

# Push master branch modifications to the server
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]> git push origin master

Counting objects: 308, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (52/52), done.
Writing objects: 100% (233/233), 75.05 kib, done.
Total 233 (delta 151), reused 226 (delta 147)
To https://github.com/geffzhang/SharpOAuth2.git
F3d8955 .. 124c360 master-> master
C: \ Users \ geffzhang \ Documents \ GitHub \ sharpoau2[ master]>

 

The following describes some useful commands:

# Create a version Library

Git init

# After each modification, You can first save the modification to stage (Snapshot/index ).

Git add <modified files>

# If you modify a large number of files, use the following command to store them in batches.

Git add.

# Use commit to submit the content in the snapshot/index to the version Library

Git commit-M "MSG"

# You can also run git add and git commit commands.

Git commit-a-m "MSG"

# Synchronize local git files with GitHub (remote)

Git push

# Synchronize GitHub (remote) git files with local ones (that is, update the local repo)

Git pull

# For example, the pull Command actually contains the fetch (replicate changes back) and merge (merge) operations.

Git pull git: // github.com/tom/test.git

# In addition, the branch Function of the version control system is also very interesting. If a bug is modified and a new function is added at the same time, fork can generate a branch: A specialized bug fix, and a specialized new function, merge merge after stabilization

Git branch bug_fix # create branch named bug_fix

Git checkout bug_fix # Switch to bug_fix

Git checkout master # Switch to the primary Repo

Git merge bug_fix # merge the bug_fix branch with the current Branch

# If you have a remote branch, you want to view and checkout it.

Git branch-R # view remote Branch

Git checkout-B bug_fix_local bug_fix_remote # Switch the local end to a remote bug_fix_remote branch and name it bug_fix_local

# There are other tools for checking the repo status

Git log # You can view the changes of each commit.

Git diff # view the content of the last change, and add parameters to view and compare other changes.

Git show # view a change

# If you want to know the status of the current work tree, you can click

Git status

Configure HTTP Proxy
Git config -- Global HTTP. Proxy http://web-proxy.xxxxx.com: 8080

Git deletes the committed commit

Method:

Git reset -- hard <commit_id>

Git push origin head -- force

Others:

Based on-soft-mixed-hard, the working tree, index, and head are reset:
Git reset-mixed
Git reset-soft: roll back to a specific version, only the commit information is rolled back, and not to the index file level. If you want to submit it, just commit it.
Git reset-hard: To completely roll back to a specific version, the local source code will also change to the content of the previous version.

Head latest submission
Head ^ last time
<Commit_id> The sha1 value of each commit. You can view it in git log or on the commit tab.

Git/GitHub is easy to use

Git/GitHub Study Notes

summarize your common git commands.

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.