1:修改账户名称以及email
修改方法很简单,跟设置时一样及
git config --global user.email '[email protected]';
2:修改文件名称
hello 文件夹下hello.txt 改为hello.java.
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal (master)
$ cd hello
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ mv hello.txt hello.java
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: hello.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello.java
no changes added to commit (use "git add" and/or "git commit -a")
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ git add hello.java
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ git rm hello
fatal: pathspec 'hello' did not match any files
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ git rm hello.txt
rm 'hello/hello.txt'
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/GitLocal/hello (master)
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
renamed: hello.txt -> hello.java
当然上面的步骤有些多,我们可以缩减为一步:
git mv hello.txt hello.java
3:创建分支
新建分支test 并切换到该分支:
$ git checkout -b test
切换分支到master:
git checkout master
4:删除分支
git branch -D branchName
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace
$ cd gitlocal
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/gitlocal (master)
$ git branch -av
* master acadb65 hello.txt rename hello.java
test 44155da add branch test file
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/gitlocal (master)
$ git branch -d test
error: The branch 'test' is not fully merged.
If you are sure you want to delete it, run 'git branch -D test'.
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/gitlocal (master)
$ git branch -D test
Deleted branch test (was 44155da).
zj@DESKTOP-065GQK6 MINGW64 /d/git/workspace/gitlocal (master)
$ git branch -av
* master acadb65 hello.txt rename hello.java
5:git log的用法
5.1 git log --online 缩减为一行。
5.2:git log 查看n个
另外输入git log 后如何 退出log 列表,继续操作呢? 请输入 q。
6:修改commit 信息
6.1:修改最近的commit 提交信息
使用 git commit --amend 进入vim 编辑状态。
进入编辑状态需要输入c。
退出vim 需要esc+大写的z两次。
查看log 修改完成。