6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【git 初心者】git+atom連携方法まとめ

6
Last updated at Posted at 2018-07-12

いつも使っているエディタAtomでバージョン管理をもっと楽にしたい&git勉強しなきゃと思ったのがきっかけです.
メモ代わりですが,ここに残しておきます.

0,ローカル環境について

$git version
git version 2.15.2 (Apple Git-101.1)

$atom -version
Atom    : 1.28.1
Electron: 2.0.4
Chrome  : 61.0.3163.100
Node    : 8.9.3

1,githubに保存しておくための手順

1, 始めに,github上で新しいレポジトリを作成する.
2, git clone “URL”でローカルのディレクトリに,gitのレポジトリを作成する.そしてcdで移動する.(git push -u origin masterのコマンドが必要かもしれない)
3, atom上でファイルを編集して保存する.
4, atom上で,ctrl+shift+”(“でgitのポップアップを出現させることができる.次に変更したファイル(色が変わっている)の中で,githubにアップロードするファイルをStageにあげる.
5, pushボタンで,githubに上げられる.(fetchボタンでmasterの変更点をローカルのレポジトリに反映できる.)

コマンド上でローカルからgithub上にアップロードするときのメモ

# 先ほど作成したGitHubリポジトリのURLをコピー&ペーストして、リモートブランチとして設定
git remote add origin https://github.com/your-name/project-name.git

# ローカルのファイルをアップロード
git push -u origin master

2, 便利なコマンド

git reset —-hard ‘commit ID’

で,もし,ローカルのファイルを全部消してしまったとしても,pushした際のcommit IDを指定することで,当時のリポジトリ状態に戻すことができる.

アドバイス,コメント等あれば,よろしくお願いします.

参考
-https://qiita.com/devzip810/items/28ac253ea295ad6c2b73

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?