27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status #查看当前操作的状态信息,目前需要把更改过的文件放入暂存区 On branch main Your branch is up to date with 'origin/main'.
Untracked files: (use "git add <file>..." to include in what will be committed) main.cpp
nothing added to commit but untracked files present (use "git add" to track)
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status #再次查看显示没有文件需要添加,可以进行提交了 On branch main Your branch is up to date with 'origin/main'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: main.cpp
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status #再次查看,可以向远程仓库origin的main分支推送更新远程仓库的代码 On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits)
nothing to commit, working tree clean
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git push origin main #向远程仓库origin的main分支推送,更新远程仓库的代码 Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 12 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 453 bytes | 453.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:YuStone0416/HelloWorld.git 8d0bec1..250b7a4 main -> main
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status On branch main Your branch is up to date with 'origin/main'.
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: main.cpp
no changes added to commit (use "git add" and/or "git commit -a")
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status On branch main Your branch is up to date with 'origin/main'.
Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: main.cpp
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git reset HEAD Unstaged changes after reset: M main.cpp
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status On branch main Your branch is up to date with 'origin/main'.
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: main.cpp
no changes added to commit (use "git add" and/or "git commit -a")
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git status On branch main Your branch is ahead of 'origin/main' by 1 commit. (use "git push" to publish your local commits)
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (sortdev) $ git pull #在本地sortdev分支是默认拉取不了的 There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (sortdev) $ git checkout main #切换为main分支 Switched to branch 'main' Your branch is up to date with 'origin/main'.
27545@oneday MINGW64 /e/Desktop/github/HelloWorld (main) $ git branch sortdev #创建sortdev分支 fatal: a branch named 'sortdev' already exists