Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Git uses a standard process     - Linux process scheduling opportunity (Programming)

- Enterprise-class GitHub warehousing environment build (Server)

- Fedora && Arch Linux - the most romantic thing to happen now (Linux)

- Getting Started with Linux system to learn: how to install USB webcams come in raspberry (Linux)

- CentOS 7 - use cgroups limit process resource (Linux)

- Linux System Getting Started Tutorial: how to find information on Linux-embedded module (Linux)

- Docker - for the development and deployment of unified lightweight Linux containers (Linux)

- Linux 4.0+ kernel support for hardware switching module (HW Switch Offload) (Linux)

- Gentoo: startx problem appears Failed to load module (Linux)

- Ubuntu 14.04 / 14.10 how to install FFmpeg 2.5.1 (Linux)

- Four Methods of Self - Learning Linux (Linux)

- Linux top command to get started (Linux)

- Why learn Java EE (Programming)

- Quickly build and install Linux KVM system (Linux)

- Source code to compile and install MySQL 5.7.9 (Database)

- How to Install lightweight Budgie desktop on Ubuntu 14.04 (v8) (Linux)

- Linux pwd command learning experience (Linux)

- Zabbix using Omsa monitor hardware information of Dell server (Server)

- Oracle table space is too large processing time (Database)

- Linux common network tools: ping host sweep (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:      
 
- Ubuntu GCC, G ++ and fortran Version Switch (Linux)
- Different between Linux file path and the windows (Linux)
- Minimum period string problem (Programming)
- Linux modify the network interface name (Linux)
- By way of a binary installation innobackupex (Database)
- About Samba certification process and permissions (Linux)
- How to fix the Ubuntu Error script returned error exit status 1 (Linux)
- Ubuntu 14.10 / 14.04 / 12.04 installation GNOME Pie 0.5.6 (Linux)
- QEMU code analysis: BIOS loading process (Linux)
- How to Create a file can not be changed under Linux (Linux)
- JavaScript basic tools list (Programming)
- MySQL optimization of the relevant Group By (Database)
- Oracle 11g modify MEMORY_TARGET (Database)
- Spring Boot + Nginx + Tomcat + SSL configuration notes (Server)
- SSH keys using login and password to log prohibited practice (Linux)
- Solaris 11 forget the root password (Linux)
- Packages with Snort intrusion monitoring light (Linux)
- An example of troubleshooting of embedded Linux OpenWRT (Linux)
- C / C ++ various data types Conversion Summary (Programming)
- Linux fixes fatal error: x264.h: No such file or directo (Linux)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.