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

Web Design: Script Materials Reconstruct User Experience

<br />Original text: http://blog.rexsong.com...

How to install Nginx in CentOS7 and configure automatic startup

1. Download the installation package from the off...

Ubuntu 20.04 how to modify the IP address example

illustrate: Today, when continuing the last offic...

Summary of Linux date command knowledge points

Usage: date [options]... [+format] or: date [-u|-...

MySQL encoding utf8 and utf8mb4 utf8mb4_unicode_ci and utf8mb4_general_ci

Reference: MySQL character set summary utf8mb4 ha...

IDEA2021 tomcat10 servlet newer version pitfalls

Because the version I used when I was learning wa...

Example of disabling browser cache configuration in Vue project

When releasing a project, you will often encounte...

DOCTYPE element detailed explanation complete version

1. Overview This article systematically explains ...

Detailed explanation of how to find the location of the nginx configuration file

How can you find the location of the configuratio...

How to write the introduction content of the About page of the website

All websites, whether official, e-commerce, socia...

Detailed discussion of the differences between loops in JavaScript

Table of contents Preface Enumerable properties I...

Basic statements of MySQL data definition language DDL

MySQL DDL statements What is DDL, DML. DDL is dat...

Summary of MySQL basic common commands

Table of contents MySQL basic common commands 1. ...

Linux system disk formatting and manually adding swap partition

Windows: Support NTFS, FAT Linux supports file fo...