Skip to content

投稿

Git チートシート

2014年10月1日 • 2 分で読める

Git チートシート

以下は、私が何度も何度も使用するGitコマンドです。

リポジトリのクローン

git clone https://github.com/tinymce/tinymce-dist.git

既存のGitファイルをリモートGitリポジトリに追加

cd /path/to/my/repo
git remote add origin https://lostinkali@bitbucket.org/lostinkali/flightstats.git
git push -u origin --all # pushes up the repo and its refs for the first time
git push -u origin --tags # pushes up any tags

既存フォルダにリポジトリを作成

git init
git add .
# Adds the files in the local repository and stages them for commit
git commit -m "Initial commit"

現在のブランチをマスターに変更

git checkout better_branch
git merge --strategy=ours master # keep the content of this branch, but record a merge
git checkout master
git merge better_branch

ブランチを削除

git branch -D bugfix

前のコミットに戻す

git checkout master
git reset --hard e3f1e37
git push --force origin master
# Then to prove it (it won't print any diff)
git diff master..origin/master

ファイルをGitに追加します。

git add [filename]

ログの最新のコミット以降の追跡されていないファイルを削除します。

git clean -fd

追加されたファイルをGitにコミットします。

git commit -m "enter message here"

ファイルをGitから削除します。-fを使用して、変更がある場合でもファイルを強制的に削除します。

git rm file1.txt

特定の時点にタグを付けます。

git tag -a v1.4 -m 'my version 1.4'

Author: Chuck Conway is an AI Engineer with nearly 30 years of software engineering experience. He builds practical AI systems—content pipelines, infrastructure agents, and tools that solve real problems—and shares what he’s learning along the way. Connect with him on social media: X (@chuckconway) or visit him on YouTube and on SubStack.

著者: Chuck Conwayは、ソフトウェアエンジニアリングの経験が30年近くあるAIエンジニアです。彼は実用的なAIシステム(コンテンツパイプライン、インフラストラクチャエージェント、実際の問題を解決するツール)を構築し、学んだことを共有しています。ソーシャルメディアで彼とつながってください: X (@chuckconway) または YouTubeSubStack で彼を訪問してください。

↑ トップに戻る

こちらもおすすめ