赞
踩
git clone xx地址
命令:file.txt
文件,并写入内容:git status
可以检查仓库的状态:git log
命令可查看当前仓库操作记录:在上文一共涉及到以下6个命令:
git clone
git clone https://github.com/username/repository.git
https://github.com/username/repository.git
是远程仓库的URL,username
是仓库所有者的用户名,repository
是仓库名。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: README.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
new_file.txt
no changes added to commit (use "git add" and/or "git commit -a")
README.md
文件已被修改但未被添加到暂存区,同时存在一个未被Git跟踪的新文件new_file.txt
。git add
git add
来标记对文件所做的改动,表明你想要包含这些改动在下次提交中。git add .
或 git add filename
git add .
将所有改动过的文件添加到暂存区。git add filename
只将名为filename
的特定文件添加到暂存区。git commit
git commit -m "Add feature X and fix bug Y"
-m
参数后跟提交信息,说明了本次提交的主要内容。git push
git push origin main
origin
指定远程仓库的名字,通常是默认的远端仓库名。main
是你要推送的分支名,也可以是其他分支名如master
、develop
等。git log
commit a1b2c3d4e5f6g7h8i9j0klmno
Author: John Doe <john.doe@example.com>
Date: Thu Feb 2 15:04:05 2023 +0800
Add feature X and fix bug Y
a1b2c3...
),这在查看历史、回退版本或比较变动时非常有用。Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。