Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Git uses a standard process     - Proxmox VE implement KVM OpenVZ virtualization cloud computing (Server)

- Why you should choose Python Programming (Programming)

- C language header file defines a global variable (Programming)

- iptraf: A Practical TCP / UDP network monitoring tools (Linux)

- RedHat 6.5 installation and deployment Openfire (Server)

- Linux some lessons learned about network security (Linux)

- High-performance open-source http accelerator Varnish introduce (Server)

- Introduction to Linux Shell (Programming)

- Incremental garbage collection mechanism for Ruby 2.2 (Programming)

- Shell programming entry (Programming)

- Oracle Client + PL SQL Developer enables remote access to the Oracle database (Database)

- The signature can not be verified under Debian (Linux)

- Spring declarative transaction management (Programming)

- C language to view various types of data size (Programming)

- Use ARChon runtime environment to run Android apps on Ubuntu (Linux)

- JavaScript common array manipulation functions and usage (Programming)

- Use virt-manager to create and manage virtual machines (Linux)

- VMware6 achieve nat Internet (Linux)

- Restrict console access to Linux servers to improve security (Linux)

- Security experience: to see how the experts deal with DDoS attacks (Linux)

 
         
  Git uses a standard process
     
  Add Date : 2018-11-21      
         
       
         
  Team development, follow a reasonable, clear Git use the process, it is very important.

Otherwise, everyone submit a bunch of disorganized commit, the project will soon become difficult to coordinate and maintain.

Here is ThoughtBot of Git use standard process. I learned a lot, so you are recommended to use Git.

The first step: New branch

First of all, every time the development of new features, it should create a separate branch (in this respect refer to "Git branch management strategy").


Get the latest code trunk #
$ Git checkout master
$ Git pull

# Create a development branch myfeature
$ Git checkout -b myfeature
Step Two: Submit branch commit

After the branch changes, you can commit the submission.


$ Git add --all
$ Git status
$ Git commit --verbose
git add all parameters to the command, indicating that save all changes (including new, modify and delete). Git 2.0 from the beginning, all the default parameters git add, so you can also use git add. Instead.

git status command to view the file changes occur.

git commit verbose command parameters, lists the results of the diff.

The third step: to submit written information

When submitting commit, must be given complete a brief submission of information, the following is a template.


Present-tense summary under 50 characters

* More information about commit (under 72 characters).
* More information about commit (under 72 characters).

http://project.management-system.com/ticket/123
The first line is not more than 50 words a synopsis, then a blank line, set out the reasons for the changes, major changes, as well as problems that need attention. Finally, a corresponding URL (eg Bug ticket).

Step Four: synchronized with the trunk

Branch of the development process, we should always keep pace with the trunk.


$ Git fetch origin
$ Git rebase origin / master
Step five: Merge commit

After the completion of the branch development is likely to have a bunch of commit, but merged into the trunk, they often expect only one (or at most twenty-three) commit, not only clear, but also easy to manage.

So, how can merge multiple commit it? This use to git rebase command.


$ Git rebase -i origin / master
i git rebase command parameter representation interactive (interactive), then git will open an interactive interface to the next step.

The following example uses Tute Costa, explain how to merge commit.


pick 07c5abd Introduce OpenPGP and teach basic usage
pick de9b1eb Fix PostChecker :: Post # urls
pick 3e7ee36 Hey kids, stop all the highlighting
pick fa20af3 git interactive rebase, squash, amend

# Rebase 8db7e8b..fa20af3 onto 8db7e8b
#
# Commands:
# P, pick = use commit
# R, reword = use commit, but edit the commit message
# E, edit = use commit, but stop for amending
# S, squash = use commit, but meld into previous commit
# F, fixup = like "squash", but discard this commit's log message
# X, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
The above interactive interface, the current branch is listed first newest four commit (more below the new). Each commit in front of a command, the default is the pick, said the bank commit is checked, you want to rebase operation.

Here are four commit a lot of notes, lists the commands you can use.

pick: select Normal
reword: select and modify the information submitted;
edit: Select when rebase will pause, allowing you to modify the commit (reference here)
squash: checked, saves the current commit and commit on a merger
fixup: the same with squash, but does not save the current commit to submit information
exec: execute other shell command
This command is among the top six, squash and fixup can be used to merge commit. first commit in front of the verb to be merged, changed squash (or s).


pick 07c5abd Introduce OpenPGP and teach basic usage
s de9b1eb Fix PostChecker :: Post # urls
s 3e7ee36 Hey kids, stop all the highlighting
pick fa20af3 git interactive rebase, squash, amend
Such a change, after the execution, the current branch leaving only two commit. commit the second and third rows, will merge to commit the first row. Will also contain information submitted, the three commit to submit information.


# This is a combination of 3 commits.
# The first commit's message is:
Introduce OpenPGP and teach basic usage

# This is the 2nd commit message:
Fix PostChecker :: Post # urls

# This is the 3rd commit message:
Hey kids, stop all the highlighting
If the command into the third row of squash fixup command.


pick 07c5abd Introduce OpenPGP and teach basic usage
s de9b1eb Fix PostChecker :: Post # urls
f 3e7ee36 Hey kids, stop all the highlighting
pick fa20af3 git interactive rebase, squash, amend
Run the same results, or generates two commit, commit the second and third lines, have combined to commit the first row. However, the new information submitted to it, the third line commit to submit information, it will be commented out.


# This is a combination of 3 commits.
# The first commit's message is:
Introduce OpenPGP and teach basic usage

# This is the 2nd commit message:
Fix PostChecker :: Post # urls

# This is the 3rd commit message:
# Hey kids, stop all the highlighting
Pony Foo suggested another easy way to commit the merger is to first withdraw the past five commit, and then build a new one.


$ Git reset HEAD ~ 5
$ Git add.
$ Git commit -am "Here's the bug fix that closes # 28"
$ Git push --force
squash and fixup command can also be used as a command line argument, and automatically merge commit.


$ Git commit --fixup
$ Git rebase -i --autosquash
This usage, please refer to this article, it is not explained here.

Step Six: push to a remote repository

After the merge commit, you can push the current branch to the remote repository.


$ Git push --force origin myfeature
git push command to add force parameters, because after the rebase, branch history has changed, not necessarily compatible with remote branches, it is possible to force push (see here).

Step Seven: Issue Pull Request

After submitting to a remote repository, it can issue Pull Request to the master branch and ask for code review, confirmation can be merged into master.
     
         
       
         
  More:      
 
- 10 Codes of good practice PHP (Programming)
- PostgreSQL 9.3.5 database installation under Ubuntu Server 14.04 (Database)
- The most simple drive to write and test procedures under linux (Programming)
- Linux remote wake the computer original code [C] (Linux)
- The Zabbix2.4.5 source compiler installation under Ubuntu 14.04 (Server)
- The principle Httpclient4.4 (execution request) (Programming)
- Lua and C ++ (Programming)
- Broadcom transplanted to OpenWrt summary (Programming)
- Install Krita 2.8 on Ubuntu 13.10 / 12.04 / 12.10 (Linux)
- Deploy Apache Spark cluster environment in Ubuntu (Server)
- Use $ BASH ENV variable to mention the right way under Linux (Linux)
- 10 tips daily Docker (Server)
- Kubernetes cluster deployment (Server)
- HBase in MVCC implementation mechanism and its application (Database)
- Let Ubuntu 14.04 Save screen luminance value (Linux)
- CentOS yum install LAMP (Server)
- Node.js simple interface server (Server)
- The official release method to upgrade to Ubuntu 15.04 (Linux)
- Cross server / client backup command: rsync use (Server)
- Correlation Analysis: FP-Growth algorithm (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.