The differences of suffixes of git reset

File statuses in git

  • Not Under git version control system
  • Modified but remain unstaged
  • Staged

Suffixes of git reset

–hard

Dangerous operation. All changes (including staged and unstaged) between the current commit and the target commit will be discarded.

–mixed

Moderate operation. All changes (Including staged and unstaged) between the current commit and the target commit will be reserved. However, staged and unstaged changes will both become unstaged.

–soft

Conservative operation. All changes (including staged and unstaged) between the current commit and the target commit will be reserved. While staged changes will remain staged, unstaged changes will remain unstaged.

Changes of files that are not under git version control system will not be affected by this command. That is to say, whether we use git reset --hard, git reset --mixed, or git reset --soft those changes will not be erased.

加我微信

想加我微信吗?

很多人私信要我的微信号,现在我将微信号公开出来。作为即将踏入社会的程序媛,我也渴望结识一些志同道合的小伙伴,一起探讨、交流。如果你也对编程充满热情,期待结交一位热心的编程伙伴,那么不妨加我微信。

我的微信号仅包含小写字母,没有数字或特殊符号。你如果在我的微信号后面添加:

suaC1KQbM7PeYpF4p5vlhvfDgban1T0bPvSbN1Mi

然后计算连接后的字符串的 SHA-1 摘要,得到的结果 Base64 编码之后将是:

2nU83IRk8VBzKDJX9SlxPIzaqgg=

请在添加时备注“来自不系之舟博客”。我期待与你一同成为好朋友,不仅可以分享技术上的经验和见解,还可以畅所欲言,聊聊人生、理想、兴趣爱好等。

主页

在这个快节奏的时代,有一位名叫 Ada 的女孩子,热爱编程,热爱生活。她用诗意的笔触,在博客里记录着自己的点滴,用生活中的美好去浇灌技术之花。

Ada 的博客,就像一个温暖的小窝,她在这里,用她的文字,分享着她的所思所想,记录下自己在编程上的探索和体验,也用她的心灵,去品味生命的美好和感悟生活的真谛。这里不仅仅是一个技术博客,更是一个充满温情的空间,她把日常的点点滴滴和技术的探索结合在一起,呈现出一个充满诗意和情感的世界。

荷香袭人,风吹发丝,湖水悠悠,Ada 仿佛置身仙境。

让我们跟随 Ada,一起探索技术和生命的奥秘,让我们在她的博客中,找到生活的美好和技术的真谛。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.yuhaowen.apps.hello;

// Welcome to Ada's Blog.
class AdaBlog {
private static AdaBlog instance;

private AdaBlog() {}

public static AdaBlog getInstance() {
if (instance == null) {
instance = new AdaBlog();
}
return instance;
}

public void writeBlog() {
// This is a template method that calls three methods to add different
// sections to the blog
addPoetry();
addTechnicalSkills();
addLifeExperience();
}

private void addPoetry() {
// Add poetic section
System.out.println("In this world of code, she weaves a poetic "
+ "tapestry with her words.");
}

private void addTechnicalSkills() {
// Add technical section
System.out.println("She shares some insights and coding tips gained "
+ "from her technical explorations.");
}

private void addLifeExperience() {
// Add life section
System.out.println("She also talks about her reflections on life and "
+ "beautiful things, creating a warm space for her readers.");
}
}

public class Main {
public static void main(String[] args) {
AdaBlog blog = AdaBlog.getInstance();
blog.writeBlog();
}
}