Difference between sourceTree & quot; reset submit & quot; and & quot; Submit rollback & quot;, sourcetree submit

Source: Internet
Author: User
Tags sourcetree

Difference between sourceTree "Reset submit" and "Submit rollback", sourcetree submit

I believe that all the partners who have used sourceTree know these two functions, but they do not necessarily use these two functions, or even cannot grasp the differences between them. According to my own tests, I can make a small summary.

  

First, let's assume that the previous versions have appeared 1, 2, 3, 4, 5, 6, 7, 8, and 9, and the current version is 9, which describes how to execute the above two operations, what are the effects?

1. Submit rollback

If I select 6 and execute "Submit rollback", you will find that the history operations of 7, 8, and 9 are still there, but the operations of 6 are restored, at this time, note that operations 7, 8, and 9 may cause a conflict when submitting rollback 6.

2. Reset the master to this version.

If I select 6 and execute "reset master to this version", you will find that the history list shows four versions earlier than this time. If you push this version, an error will be reported, the display means there is a pull, but if you pull it, you will find it restored again, and before the reset, what should we do? It must be pushed only, only by checking the information can we know that we need to modify the sourceTree settings at this time to implement forced push.

Note: Here, we recommend that you enable force push when necessary and disable it when you use it (enable method: sourceTree-> preference settings-> General-> enable "allow force push ")

    

Don't think this is enough. If you force push or display fails after setting, the information is shown as follows:

! [Remote rejected] master-> master (pre-receive hook declined)

The final reason why git push cannot be obtained is that the branch permission of push is protected. Only the Project Administrator or project administrator can assign the corresponding permissions to push, by default, the [master] branch is under protection. There are two ways to push the project:

1. Disable the protected permission of the branch where the content to be pushed is located.

(1) enter the settings of the project, click Enter Protected branches, click unprotected to change the master branch permissions, that is, disable the master's protected permissions.

    

 

2. Create another branch, push the project to the new branch, and then perform merge

(1) create a branch

Git branch name

(2) Switch Branch

Git checkout branch name

(3) Upload a project

Git add. git commit-m "submitted information" git remote add origin remote repository address git push-u origin branch name

 

  

Related Article

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.