Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Git uses a basic tutorial     - You must ask yourself four questions before deploying Docker (Server)

- Redis is installed in Ubuntu 14.04 (Database)

- To deploy MySQL database with separate read and write OneProxy (Database)

- Read the official GNU Make manual one (chapter 1-2) (Programming)

- CentOS minimal network is unavailable resolved (Linux)

- Snort build a secure Linux server (Linux)

- Restore database fault encountered ORA-0600 (Database)

- Linux compiler of GCC (Linux)

- ORA-12547: TNS: lost contact error Solution (Database)

- C # get the current screenshot (Programming)

- How to update the Linux kernel to improve system performance (Linux)

- Creating and extracting archives 11 tar command examples in Linux (Linux)

- Easy to get hidden administrator account (Linux)

- Installation through the network Debian 7 (Wheezy) (Linux)

- Management Linux Container with Docker in Ubuntu (Linux)

- About Linux operating system security (Linux)

- RabbitMQ Getting Started Tutorial (Linux)

- Under CentOS using yum command to install the Task Scheduler crontab (Linux)

- CentOS 7 Docker build private warehouse registry (Linux)

- Oracle Database import and export combat (Database)

 
         
  Git uses a basic tutorial
     
  Add Date : 2017-01-08      
         
         
         
  Written below in fact written for internal use Git based tutorial, I am here also recorded.

Modify Git configuration

windows operating system configuration wrap

git config --global core.autocrlf input
User name, mailbox configuration

git config user.name yourname --local
git config user.email yourname@tudou.com --local
Cloning v3 code library

git clone git@gitlab.intra.tudou.com: static / v3.git
View branch

Lists all the local branches

git branch
Lists all remote branches

git branch -r
Create a branch

Local branch created based on

git branch [BRANCH_NAME]
git push origin [BRANCH_NAME]
Created based on the remote branch

git branch [BRANCH_NAME] origin / master
Local branch and remote branch bound

After binding operation can be omitted origin [branch], more convenient and efficient, of course, if there are multiple remote operator needs can not be omitted

git push -u origin [branch]
Branch switching

Switch to the local branch, if the local branch does not exist automatically find the remote branch

git checkout [BRANCH_NAME]
Update branch

Update master

git pull --rebase origin master
Rebase resolve the conflict.

git status
# Follow the prompts to open the corresponding file, search for "<<<<<<<" character, post-conflict execution

git add -u
git rebase --continue
# Stop operating state pull back pull rebase before

git rebase --abort
Submit Codes

Submit to a local repository

git commit -m "commit message"
Submit to a remote master

git push origin master
Merge Branches

Switch to master.

git checkout master
Merge branches.

git merge --no-ff [BRANCH_NAME]
Resolve conflicts src directory.

https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line
Using an external tool to resolve conflict

Resolve all conflicts of this merger

git mergetool
Resolve conflicts specific files

git mergetool src / js / g.js
Rebuild build, document all conflicts dist directory under.

ytpm [PATH]
Submit code.

git add.
git commit -m "commit message"
Recovery code

Abandon local modifications (discard all uncommitted local files and remote consistent)

git reset --hard origin / master
Submit a resume

git revert [COMMIT_ID]
Recovery merge

git revert -m 1 [MERGE_COMMIT_ID]
Recovered to a specific version

git reset --hard [COMMIT_ID]
Remove branches

Remove local branch

git branch -d [BRANCH_NAME]
Delete remote branch

git push origin --delete [BRANCH_NAME]
View change history

View change history

git log --decorate --numstat [PATH]
View a commit record

git show --name-only [COMMIT_ID]
Compare Files

git default mode

Compare versions and workspace versions staging area

git diff - [PATH]
Compare staging area version and the repository version

git diff --cached - [PATH]
Compare Workspace version and the repository version (HEAD)

git diff HEAD - [PATH]
Compare two documents submitted

git diff [COMMIT_ID_1] [COMMIT_ID_2] - [PATH]
Compare the two branches of the file

git diff develop master - src / js / g.js
git diff develop: src / js / g.js master: src / js / g.js
See other files on a branch

git show master: src / js / g.js
External comparison tool complete comparison

Compare all modifications of this combined (compared to only record prior to submission)

git difftool
Compares the specified version of the file history

git difftool [GitHash] HEAD - src / js / g.js
Careless development on develop solutions

Uncommitted

git stash
git checkout [BRANCH_NAME]
git stash pop

When Submitted

git log -1 # Remember COMMIT ID
git reset --hard origin / develop
git checkout [BRANCH_NAME]
git cherry-pick [COMMIT_ID]
Solutions will develop careless or branch-based develop merge to create the master

A - M --- B <--- develop
\
--C - G --- J --- P --- Q <--- master
The example above, we need to confirm the good points as well as the dates of the J prior to, after the submission of hash value of the point and make sure that HEAD is currently on Q, then execute:

git rebase -i -p --onto P G
After the implementation of the latter need to manually after each commit to resolve conflicts, manual comparison to get rid of the conflict execution:

git add. // Add the conflict modify

git rebase --continue
Note that the above steps may be carried out many times, each time the above method; manual method of comparison can be found in [external comparison tool] [1] is used.

other
Beyond Compare Configuration Comparison Tool
Adding ~ / .gitconfig following configuration file, use the comparison tool Beyond Compare, you can download their own; if the user is the path to win the corresponding need to be amended accordingly.

In addition, Mac version of Beyond Compare 4 also need to be allowed to set up support through command line calls: Tap Menu -> Install Commond Line Tools ... then enter the system login password.
[Merge]
tool = bcomp
[Mergetool]
prompt = false
keepBackup = false
[Mergetool "bcomp"]
trustExitCode = true
cmd = "/ usr / local / bin / bcomp" "$ LOCAL" "$ REMOTE" "$ BASE" "$ MERGED"
[Diff]
tool = bcomp
[Difftool]
prompt = false
[Difftool "bcomp"]
trustExitCode = true
cmd = "/ usr / local / bin / bcomp" "$ LOCAL" "$ REMOTE"

Common git Alias

[Alias]
st = status --short - branch
pu = pull --rebase
ca = commit --amend
ci = commit -a -v
br = branch
bv = branch -vv
co = checkout
cb = checkout -b
df = diff
un = reset --hard HEAD
uh = reset --hard HEAD ^
ll = log --pretty = format: "% C (yellow)% h% Cred% d \\% Creset% s% Cblue \\ [% cn]" - decorate --numstat
ld = log --pretty = format: "% C (yellow)% h \\% C (green)% ad% Cred% d \\% Creset% s% Cblue \\ [% cn]" - decorate - date = short - graph
ls = log --pretty = format: "% C (green)% h \\% C (yellow) [% ad]% Cred% d \\% Creset% s% Cblue \\ [% cn]" - decorate --date = relative
     
         
         
         
  More:      
 
- How to enhance the Nagios server security (Linux)
- Five programming fallacy (Programming)
- Getting Started with Linux: Learn how to upgrade Docker in Ubuntu (Server)
- Rails 4.1.6 start being given Could not find a JavaScript runtime (Linux)
- Use Bosh deploy CloudFoundry problems encountered on OpenStack (Server)
- The Definitive Guide to Linux NAT network connection (Linux)
- CentOS 6.5 installation configuration DRBD (Server)
- Availability Hadoop platform - Oozie Workflow (Server)
- ActionContext and ServletActionContext Summary (Programming)
- Composition and dynamic memory allocation C program (Programming)
- Use Ambari rapid deployment Hadoop big data environment (Server)
- C ++ implementation of the list of basic operations and test cases (Programming)
- Management and application Oracle external table (Database)
- Java String type time compare the size (Programming)
- Get the Linux device PCI ID method (Linux)
- Linux system Passwd file detailed analysis (Linux)
- CentOS6 5 Configure SSH password Free (Linux)
- Win8 mount disk partitions under Ubuntu (Linux)
- Three kinds of binary tree traversal recursive and iterative solution (Programming)
- IBM Data Studio to create objects using ---- double quotes / sensitive issues and the table / column renaming (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.