git入门

这里对git init、git add、git commit命令进行一个总结。 $ git init 命令,该命令将创建一个名为 .git 的子目录,这个子目录含有你初始化的 Git 仓库中所有的必须文件;

$ git add 命令,该命令用于把我们要提交的文件的信息添加到远程库中;

$ git commit 命令,该命令用于把推送修改到本地库中。

例子:

1.git init

Initializes a new local Git repository.

- Initialize a new local repository:

git init

- Initialize a barebones repository, suitable for use as a remote over ssh:

git init --bare

2. git add

Adds changed files to the index.

- Add a file to the index:

git add path/to/file

- Add all files (tracked and untracked):

git add -A

- Only add already tracked files:

git add -u

- Also add ignored files:

git add -f

- Add parts of a file interactively:

git add -p path/to/file

3.git commit

Commit files to the repository.

- Commit staged files to the repository with a message:

git commit -m message

- Replace the last commit with currently staged changes:

git commit --amend

- Auto stage all modified files and commit with a message:

git commit -a -m message

上传到git hub更新

首先进入到我们要上传的目录 比如 cd demo1

git init

创一个html文件 touch index.html

接下来将这个文件

git add index.html

然后 git commit .m “标题”

git pull

git push

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容