ubuntuとwin10のノートPCで自分用のツールをいろいろ作ってるんですが、
年末の帰省時にノートPCを持っていって映画情報投稿ツールをアップデートしました。
しかしデスクトップubuntuのローカルリポジトリは古いままです。
家ではデスクトップの方を使いたいのでリポジトリを最新化しないといけません。
いつもcloneかpushしかしないのですが、最新化はどうやればいいんでしょうか?
pullでいけそう
gitってたくさんコマンドがあってややこしいですが、
いろいろググるとpullで最新化できるようです。
pullはfetch + mergeをやっている様ですね。
ちょっとpullをやってみましょう。
- 今の
masashi@PC-ubuntu:~/movietweet$ ls -la 合計 52 drwxr-xr-x 4 masashi masashi 4096 10月 19 21:51 . drwxr-xr-x 47 masashi masashi 16384 1月 14 22:08 .. drwxr-xr-x 3 masashi masashi 4096 10月 19 21:53 .git -rw-r--r-- 1 masashi masashi 13 9月 4 23:15 .gitignore -rw-r--r-- 1 masashi masashi 1407 9月 4 23:18 README.md drwxr-xr-x 2 masashi masashi 4096 9月 7 23:17 __pycache__ -rw-r--r-- 1 masashi masashi 202 9月 4 23:16 configure.py -rw-r--r-- 1 masashi masashi 355 10月 19 21:51 posttw.py -rw-r--r-- 1 masashi masashi 180 9月 4 23:16 requests.txt -rw-r--r-- 1 masashi masashi 567 9月 4 23:16 twmovieinfo.sh
最新のはaccess tokenのファイル切り出しとmovie getのファイルを作成しています。
- pullしてみる
masashi@PC-ubuntu:~/movietweet$ git pull origin master fatal: not a git repository (or any of the parent directories): .git
エラーですね。
メッセージをググります。
初期設定とリモートリポジトリの設定
ユーザの設定とリモートリポジトリを設定します。
(以前やったような気もするが)
masashi@PC-ubuntu:~/movietweet$ git config --global user.name "Masashi XXXX" masashi@PC-ubuntu:~/movietweet$ git config --global user.email "xxxxx@gmail.com"
- init
masashi@PC-ubuntu:~/movietweet$ git init
Initialized empty Git repository in /home/masashi/movietweet/.git/
masashi@PC-ubuntu:~/movietweet$ git remote add origin https://github.com/masashi69/movietweet.git
もう一度
masashi@PC-ubuntu:~/movietweet$ git pull origin master remote: Enumerating objects: 12, done. remote: Counting objects: 100% (12/12), done. remote: Compressing objects: 100% (10/10), done. remote: Total 12 (delta 2), reused 11 (delta 1), pack-reused 0 Unpacking objects: 100% (12/12), done. From https://github.com/masashi69/movietweet * branch master -> FETCH_HEAD * [new branch] master -> origin/master error: The following untracked working tree files would be overwritten by merge: .gitignore README.md posttw.py requests.txt twmovieinfo.sh Please move or remove them before you merge. Aborting
ファイルを消せって出てますね。
上書きしてくれないのかな?
とりあえず消します。
masashi@PC-ubuntu:~/movietweet$ rm .gitignore README.md posttw.py requests.txt twmovieinfo.sh masashi@PC-ubuntu:~/movietweet$ ls -l 合計 8 drwxr-xr-x 2 masashi masashi 4096 9月 7 23:17 __pycache__ -rw-r--r-- 1 masashi masashi 202 9月 4 23:16 configure.py
再々チャレンジ
masashi@PC-ubuntu:~/movietweet$ git pull origin master From https://github.com/masashi69/movietweet * branch master -> FETCH_HEAD masashi@PC-ubuntu:~/movietweet$ ls -la 合計 60 drwxr-xr-x 4 masashi masashi 4096 1月 14 22:22 . drwxr-xr-x 47 masashi masashi 16384 1月 14 22:17 .. drwxr-xr-x 8 masashi masashi 4096 1月 14 22:22 .git -rw-rw-r-- 1 masashi masashi 13 1月 14 22:22 .gitignore -rwxrwxr-x 1 masashi masashi 1660 1月 14 22:22 README.md drwxr-xr-x 2 masashi masashi 4096 9月 7 23:17 __pycache__ -rw-r--r-- 1 masashi masashi 202 9月 4 23:16 configure.py -rw-rw-r-- 1 masashi masashi 344 1月 14 22:22 gettw.py -rw-rw-r-- 1 masashi masashi 332 1月 14 22:22 posttw.py -rw-rw-r-- 1 masashi masashi 180 1月 14 22:22 requests.txt -rwxrwxr-x 1 masashi masashi 381 1月 14 22:22 tweetapi.py -rw-rw-r-- 1 masashi masashi 567 1月 14 22:22 twmovieinfo.sh
出来ました!
gettw.pyとtweetapi.pyファイルが新たにできていますね。
しかし日付が今日になっている…やり方として合っているのだろうか…
とりあえず目的は果たせました
日付の動きは確認するとして一応最新化はできたかな?
自分用のツールなのでコード書くのも私一人ですが、
PCを分ける使い方をしている場合は便利ですね。
ますますデスクトップとノートの使い分けが進みそうです。
作るのも使うのも1人なんで毎回マスターブランチ直更新なんですが、
ブランチ切ってマージする、という日は来るんでしょうか。