git入門

這里對git init、git add、git commit命令進(jìn)行一個總結(jié)。 $ git init 命令,該命令將創(chuàng)建一個名為 .git 的子目錄,這個子目錄含有你初始化的 Git 倉庫中所有的必須文件;

$ git add 命令,該命令用于把我們要提交的文件的信息添加到遠(yuǎn)程庫中;

$ 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更新

首先進(jìn)入到我們要上傳的目錄 比如 cd demo1

git init

創(chuàng)一個html文件 touch index.html

接下來將這個文件

git add index.html

然后 git commit .m “標(biāo)題”

git pull

git push

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容