基本的なgitコマンド
7172 ワード
gitとコマンドラインで作業することができます.それを助けるために、私はいくつかの基本的なgitコマンド、それぞれが意味するもの、およびそれらを使用する方法と共に記載しました.
コマンド
使用法:
空のgitリポジトリを作成するか、既存のものを再初期化します.また、プロジェクト名を指定することで、新しいディレクトリ内にレポジトリを作成します.
コマンド
使用法:
既存のリモートリポジトリのローカルワーキングコピーを作成するために使用します.
コマンド
使用法:
gitのステージング領域にファイルを追加します.コミットが倉庫になされる前に、ファイルはGitインデックスに加えられる必要があります.
コマンド
使用法:
作業ツリーとインデックスからファイルを削除します.
コマンド
使用法:
コミットログを表示します.
コマンド
使用法:
作業ツリーの状態を表示します.
コマンド
使用法:
リストを作成、削除または分岐を削除します.
コマンド
使用法:
スイッチ分岐または作業ツリーファイルを復元します.
コマンド
使用法:
リポジトリへのレコードの変更.
コマンド
使用法:
一緒に2つ以上の開発履歴を結合します.
コマンド
使用法:
別のリポジトリからダウンロードオブジェクトとrefs.
コマンド
使用法:
別のリポジトリまたはローカルブランチから取得し、統合します.
コマンド
使用法:
関連付けられたオブジェクトとともにリモートリモートリファレンスを更新します.
コマンド
使用法:
ローカルリポジトリをリモートリポジトリに接続するために使用します.
更なる学習
より多くのコマンドがたくさんあります.ここでは役に立つかもしれないいくつかの参照があります. Basic Git Commands by Atlassian Git Tutorials Git Handbook Git Commands by Hostinger Tutorials 読書のおかげで、私はあなたがgit完了を願っています.🎉
コマンド
git init
使用法:
空のgitリポジトリを作成するか、既存のものを再初期化します.また、プロジェクト名を指定することで、新しいディレクトリ内にレポジトリを作成します.
$ git init
#initailize empty git repository with a name
$ git init <project-name>
コマンド
git clone
使用法:
既存のリモートリポジトリのローカルワーキングコピーを作成するために使用します.
$ git clone <remote-repository>
コマンド
git add
使用法:
gitのステージング領域にファイルを追加します.コミットが倉庫になされる前に、ファイルはGitインデックスに加えられる必要があります.
#add all files
$ git add .
#add a specific file:
$ git add <file-name>
#add an entire directory:
$ git add <directory-name>
コマンド
git rm
使用法:
作業ツリーとインデックスからファイルを削除します.
#remove a file from the working index (cached)
$ git rm --cached <file-name>
#delete a file (force)
$ git rm -f <file-name>
コマンド
git log
使用法:
コミットログを表示します.
#show entire git log
$ git log
#show git log based on commit author
$ git log --<author>="Author Name"
コマンド
git status
使用法:
作業ツリーの状態を表示します.
$ git status
コマンド
git branch
使用法:
リストを作成、削除または分岐を削除します.
#create a new branch
$ git branch <branch-name>
#list all remote or local branches
$ git branch -a
#delete a branch
$ git branch -d <branch-name>
コマンド
git checkout
使用法:
スイッチ分岐または作業ツリーファイルを復元します.
#checkout an existing branch
$ git checkout <branch-name>
#checkout and create a new branch
$ git checkout -b <new-branch>
コマンド
git commit
使用法:
リポジトリへのレコードの変更.
#add a commit with a message
$ git commit -m "commit message in quotes"
コマンド
git merge
使用法:
一緒に2つ以上の開発履歴を結合します.
#merge changes into current branch
$ git merge <branch-name>
コマンド
git fetch
使用法:
別のリポジトリからダウンロードオブジェクトとrefs.
#fetch all of the branches from the repository
$ git fetch <remote-name>
#fetch the specified branch
$ git fetch <remote-name> <branch-name>
コマンド
git pull
使用法:
別のリポジトリまたはローカルブランチから取得し、統合します.
$ git pull <branch-name> <remote-name>
コマンド
git push
使用法:
関連付けられたオブジェクトとともにリモートリモートリファレンスを更新します.
$ git push <remote-name> <branch-name>
# push all local branches to a remote repository
$ git push —all
コマンド
git remote
使用法:
ローカルリポジトリをリモートリポジトリに接続するために使用します.
#add remote repository
$ git remote <command> <remote-name> <remote-URL>
#list named remote repositories
$ git remote -v
更なる学習
より多くのコマンドがたくさんあります.ここでは役に立つかもしれないいくつかの参照があります.
Reference
この問題について(基本的なgitコマンド), 我々は、より多くの情報をここで見つけました https://dev.to/anisha/basic-git-commands-33ecテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol