Learn one minute a day to use Git server to view debug branches and fix them

Learn one minute a day to use Git server to view debug branches and fix them

Debug branch

During the normal development of a project, previously released versions may have bugs. In this case, you need to stop the current development task, fix the bug first, and then come back to continue the development task after the bug is fixed.

Stash in git provides a function to save the site, which can save the content in the current workspace and temporary storage area without committing, and then fix the bug. After completion, restore the site and continue development work.

The example is as follows: Stop the current work, fix a bug in the master branch, and modify the dailyfresh/settings.py file

The original content of language and time zone is

LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'

Change the language and time zone to

LANGUAGE_CODE = 'zh-Hans'
TIME_ZONE = 'Shanghai/Asia'

1. Check the current status

git status

2. Save the scene

git stash

Check the current status again and find that it is clean

git status

3. Switch to the master branch

git checkout master

4. Create a temporary branch to fix bugs

This branch will be deleted after use

git checkout -b bug001

5. According to the above design, modify the language and time zone of the dailyfresh/settings.py file

as follows

LANGUAGE_CODE = 'zh-Hans'
TIME_ZONE = 'Shanghai/Asia'

Add: Add changes in the workspace to the staging area

Note: The current directory is the directory where the manage.py file is located

(py_django) python@ubuntu:~/Desktop/pytest/django1/dailyfresh$ git add dailyfresh/settings.py

Submit: Submit the contents of the temporary storage area to the warehouse area

git commit -m 'Fix timezone language'

6. Switch back to the master branch

git checkout master

7. Merge the bug001 branch into the master branch

Because temporary branches will be deleted after use, you cannot query the history through branches. Therefore, when using temporary branches, you need to use the no-ff method and write the -m comment information.

git merge --no-ff -m "Fix bug-language time zone" bug001

Push to server

git push

8. Delete temporary branch bug001

git branch -d bug001

9. Switch back to the working branch zhujiao

git checkout zhujiao

View the site list

git stash list

Restoration site

git stash pop

Check the work status after restoring the site

git status

You can continue developing in this branch

This is the end of this article about learning Git for one minute every day to view Debug branches and repair them. For more relevant Git viewing Debug branches and repair content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed steps to build a Git server on CentOS
  • Detailed explanation of building your own Git server under CentOS
  • Steps to build a Git server under Linux
  • Alibaba Cloud Linux-CentOS System-Detailed Explanation of Building Git Server
  • Detailed explanation of how to build a Git server under Linux

<<:  MySQL deep paging (how to quickly paginate tens of millions of data)

>>:  Flex layout makes adaptive pages (syntax and examples)

Recommend

Share MySql8.0.19 installation pit record

The previous article introduced the installation ...

A brief analysis of HTML space code

How much do you know about HTML? If you are learni...

Solve the problem when setting the date to 0000-00-00 00:00:00 in MySQL 8.0.13

I just started learning database operations. Toda...

Implementation of code optimization for Vue2.x project performance optimization

Table of contents 1 Use of v-if and v-show 2. Dif...

Example code of javascript select all/unselect all operation in html

Copy code The code is as follows: <html> &l...

4 flexible Scss compilation output styles

Many people have been told how to compile from th...

How are spaces represented in HTML (what do they mean)?

In web development, you often encounter characters...

Explain TypeScript enumeration types in detail

Table of contents 1. Digital Enumeration 2. Strin...

How to use @media in mobile adaptive styles

General mobile phone style: @media all and (orien...

MySQL advanced learning index advantages and disadvantages and rules of use

1. Advantages and Disadvantages of Indexes Advant...

Vue implements Modal component based on Teleport

Table of contents 1. Get to know Teleport 2. Basi...

Binary Search Tree Algorithm Tutorial for JavaScript Beginners

Table of contents What is a Binary Search Tree (B...

Achieve 3D flip effect with pure CSS3 in a few simple steps

As a required course for front-end developers, CS...