20210501のGitに関する記事は5件です。

GitHubでプライベートな組織の登録メンバリストを取得するには

前回記事も一年前になりましたが、今年もGitHubを使った演習を続けています。前年度も何か色々書くこともあった気がするんですが、忙しくてすっかり忘れてしまったので略。 来年度もおそらく続くと思われるので、いくつか後で見返すためのメモをこの辺に書いておきます。 課題:未登録者をチェックしたいので、現時点での組織の登録メンバ一覧が欲しい 解決策:GitHub APIで取得できるらしい。 実行結果: $ curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/orgs/$ORG/members [ ] …中身がないな? 組織がプライベートなのでおそらくアクセスが出来てない模様。 サブ課題:プライベートな組織にアクセスするには 解決策:個人アクセストークンを発行してそれを使えば行けるらしい 実行: 「個人アクセストークンを使用する」を参考にトークンを取得 https:// と api の間にトークンを挿入して再実行 $ curl -H "Accept: application/vnd.github.v3+json" https://$TOKEN@api.github.com/orgs/$ORG/members 無事に出たぽい。後はこれをJSONから適当な形式に変換するだけですね。 とりあえずメモ終わり。 追記メモ:JSONをCSVファイルへ変換する方法 この辺を参考に変換を試みた。 cat members.json | jq -r '["login"], (.[] | [.login]) | @csv' > members.csv 一列しかないのでtxtでも良いかも。ともあれ、できました。 追記メモ:複数ページへ渡る場合はURLに?page=でページ指定が必要
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Git ブランチの見つけ方 形跡たどる

このコードが入ったor削除された原因、タスクを調査して欲しい 意図しないバグや不具合が起きている場合に、 ディレクターさんにこんなお願いされることがたまにあります。 gitでソースコードの対象範囲がいつ変更されたのか調べる git log -L 最初の行,最後の行:ファイル名 上記で、対象のソースコードの変更履歴を調べ、変更された時のコミットを見つける 対象のコミットが含まれているブランチを特定する git branch -r --contains <対象の変更範囲が含まれているコミットID> 拙い文章や間違ってること、こうした方がいい等があると思いますので、 アドバイスや助言をいただけると嬉しいです。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

git pullすると warning が出た

git pullするとこんなエラー文が 分岐しているリポジトリを一致させる方法を、指定しないことはおすすめできません。pullする前にこのいずれかのコマンドを実行してください。 という事が書かれており、3つコマンドが提示されています。 warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation. Git 2.27.0 から pull をすると表示されるようです pullした際に、pull --rebase や pull --ff-only の挙動を期待していたユーザーが意図しないマージコミットを作ってしまうことを避けるために、このようなエラーが出るらしい。 rebase false が良さそう 下記のコマンドを実行することで、デフォルトのpullの挙動になる。 git config pull.rebase false rebaseの際に、明示的に --rebase をつける設定です。 git config pull.rebase true 逆に上記設定にすると、pullしただけで、 pull --rebase をするようになります。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

git pullしたら怒られた・・

git pullするとこんなエラー文が 分岐しているリポジトリを一致させる方法を、指定しないことはおすすめできません。pullする前にこのいずれかのコマンドを実行してください。 という事が書かれており、3つコマンドが提示されています。 warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation. Git 2.27.0 から pull をすると表示されるようです pullした際に、pull --rebase や pull --ff-only の挙動を期待していたユーザーが意図しないマージコミットを作ってしまうことを避けるために、このようなエラーが出るらしい。 rebase false が良さそう 下記のコマンドを実行することで、デフォルトのpullの挙動になる。 git config pull.rebase false rebaseの際に、明示的に --rebase をつける設定です。 git config pull.rebase true 逆に上記設定にすると、pullしただけで、 pull --rebase をするようになります。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

git pullしたら怒られた・・(git 2.27)

git pullするとこんなエラー文が 分岐しているリポジトリを一致させる方法を、指定しないことはおすすめできません。pullする前にこのいずれかのコマンドを実行してください。 という事が書かれており、3つコマンドが提示されています。 warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation. Git 2.27.0 から pull をすると表示されるようです pullした際に、pull --rebase や pull --ff-only の挙動を期待していたユーザーが意図しないマージコミットを作ってしまうことを避けるために、このようなエラーが出るらしい。 rebase false が良さそう 下記のコマンドを実行することで、デフォルトのpullの挙動になる。 git config pull.rebase false rebaseの際に、明示的に --rebase をつける設定です。 git config pull.rebase true 逆に上記設定にすると、pullしただけで、 pull --rebase をするようになります。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む