Git collaborative work-non-fast forward push

Source: Internet
Author: User

Git collaborative work-non-fast forward push

Non-fast-forwardupdates is pushed when the content of the remote version Library and the current version library is inconsistent. This is generally caused by multi-member collaboration, other users pushed to the remote version library between the previous commit and the current commit.

Non-fast forward push logs:

Figure 1

This is the commit hash value for the remote and current version libraries.

Go to the. git directory to view the latest commit information of the local version Library:

Figure 2

View the remote version library commit information:

Figure 3

We can see that there is a difference between the two, that is, "non-fast forward push ".

Solution:
  1. Force push.

Use gitpush origin master -- force or gitpush origin master-f.

However, this method may overwrite other people's submissions. It can be used when it is determined that it will not affect others' submissions, such as using gitcommit-amend to modify the submission log.

  1. Execute pull and continue Push, that is, merge and Push. This is how multi-member collaborative recommendation works.

Gitpull

Gitpush origin master

Others

Of course, in the team collaboration management, non-fast forward push can also be disabled. You can use the receive. denyNonFastForwards variable or the hook script to set it.

Install Git on Ubuntu Server

Create a Git repository on the server (Ubuntu)

Git simple tutorial in Linux (taking Android as an example)

Git authoritative guide PDF

Git details: click here
Git: click here

This article permanently updates the link address:

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.