web-dev-qa-db-ja.com

githubリポジトリ内のファイルを要点に変換する方法

私がやりたいのは この質問 の逆です。変更を続けたいd3ビジュアライゼーションを含むgithubリポジトリ内のフォルダーがあります。このリポジトリの「要点」バージョンを使用して、bl.ocks.orgに視覚化を表示し、満足した後でプライマリリポジトリからいつ変更をプッシュできるかを確認できれば便利です。

別の同様の質問は ここ ですが、回答は手順の要点-> bl.ocks.orgを説明しています。ステップgithupリポジトリ->要点がわかりません。これを達成するための最良の方法は何ですか?

26
bill_e

まず、Gistはディレクトリをサポートしていないことに注意してください。リポジトリをGistにインポートするには、次の手順に従います。

  1. 新しいGistを作成し、ローカルで複製します(ダミーIDをGist IDに置き換えます)。

    git clone [email protected]:792bxxxxxxxxxxxxxxx9.git
    
  2. cdをそのGistディレクトリに

  3. GitHubリポジトリからプルしてマージします。

    git pull [email protected]:<user>/<repo>.git
    
  4. 変更をプッシュする

    git Push
    

繰り返しますが、ディレクトリがある場合は、それらを削除してコミットする必要があることに注意してください。

rm -rf some-directory
git commit -m 'Removed some-directory' .

上記の手順を使用して、プロジェクト履歴が保持されます。履歴を気にしない場合は、いつでもGistにファイルをプッシュできます。複数のフォルダーを含むリポジトリがあり、各フォルダーに要点を作成するとします。次の手順を繰り返します(またはスクリプトで実行できます)。

git clone [email protected]:<Gist-id>.git
cd <Gist-id>
cp ../path/to/your/github/repository/and/some/folder/* .
git add .
git commit -m 'Added the Gist files' .
git Push

要旨はGitHubの動作とは異なります。

要旨は、スニペットとペーストを他の人と共有する簡単な方法です。すべての要点はGitリポジトリであるため、Gitから自動的にバージョン管理され、フォーク可能で使用可能になります。

ただし、Gistsでディレクトリをプッシュしようとすると、リモートからエラーが発生します。

$ git Push
Counting objects: 32, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (32/32), 7.35 KiB | 0 bytes/s, done.
Total 32 (delta 10), reused 0 (delta 0)
remote: Gist does not support directories.
remote: These are the directories that are causing problems:
remote: foo
To [email protected]:792.....0b79.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to Push some refs to '[email protected]:79.......9.git'
23
Ionică Bizău