Git restores the deleted branch and content, and git restores the branch

Source: Internet
Author: User

Git restores the deleted branch and content, and git restores the branch

Git Delete Branch
Git branch-D branch name
Git view branch git branch-
Git Delete remote branch git push origin: branch name
Note: If the git branch is submitted and pushed, but the branch is deleted, the items submitted on the branch are also deleted.
The correct sequence is: git commit = git checkout master = git merge branch name => git push
Resolution: Switch git to the master branch,
Merge the items on the branch,
Git push for pushing,
At this time, the master Branch has been merged and pushed,
The useless branches can be deleted normally.
If the git branch is deleted first,
But not merged,
Recovery Method:
First:
Git log-g // view all log records, find the commit id when the branch was submitted, and copy only the id
Git branch new branch name submit id // create a new branch. At this time, the new branch contains the content of the version just submitted.
Then
Git checkout master = git merge branch name => git push
 

 

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.