<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://wiki.r371.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=371</id>
	<title>オレッジベース - 利用者の投稿記録 [ja]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.r371.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=371"/>
	<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php/%E7%89%B9%E5%88%A5:%E6%8A%95%E7%A8%BF%E8%A8%98%E9%8C%B2/371"/>
	<updated>2026-04-26T19:46:47Z</updated>
	<subtitle>利用者の投稿記録</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Raspbian_Stretch%E3%81%ABRedmine&amp;diff=158</id>
		<title>Raspbian StretchにRedmine</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Raspbian_Stretch%E3%81%ABRedmine&amp;diff=158"/>
		<updated>2025-10-25T19:24:48Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Rubyのインストール ===&lt;br /&gt;
RedmineはRubyで動いているらしい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y ruby&lt;br /&gt;
$ ruby -v&lt;br /&gt;
ruby 2.3.3p222 (2016-11-21) [arm-linux-gnueabihf]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Railsのインストール ===&lt;br /&gt;
Railsというフレームワークを使っているらしい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo gem install rails&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
エラー発生&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
ERROR:  Error installing rails:&lt;br /&gt;
        ERROR: Failed to build gem native extension.&lt;br /&gt;
&lt;br /&gt;
    current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri&lt;br /&gt;
/usr/bin/ruby2.3 -r ./siteconf20171226-14608-1mjalst.rb extconf.rb&lt;br /&gt;
mkmf.rb can&#039;t find header files for ruby at /usr/lib/ruby/include/ruby.h&lt;br /&gt;
&lt;br /&gt;
extconf failed, exit code 1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
ruby-devをインストールすると解消されるらしい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y ruby-dev&lt;br /&gt;
$ sudo gem install rails&lt;br /&gt;
$ rails -v&lt;br /&gt;
Rails 5.1.4&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Bundlerのインストール ===&lt;br /&gt;
Redmineが使用するgemパッケージをインストールするのに使われるらしい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo gem install bundler --no-rdoc --no-ri&lt;br /&gt;
$ bundler -v&lt;br /&gt;
Bundler version 1.16.1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Apacheとヘッダファイルのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y apache2 apache2-dev libapr1-dev libaprutil1-dev&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ImageMagickとヘッダファイル・日本語フォントのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y imagemagick libmagick++-dev fonts-takao-pgothic&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
エラー発生&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
E: パッケージ fonts-takao-pgothic が見つかりません&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
fonts-takao-pgothicはfonts-takao-gothicに含まれているっぽい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y imagemagick libmagick++-dev fonts-takao-gothic&lt;br /&gt;
$ ls /usr/share/fonts/truetype/takao-gothic/&lt;br /&gt;
TakaoGothic.ttf  TakaoPGothic.ttf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Gitのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y git&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== DBの作成（MariaDB） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;gt; GRANT ALL PRIVILEGES ON &amp;lt;DATABASE_NAME&amp;gt;.* TO &amp;lt;USER_NAME&amp;gt;@&amp;lt;HOST&amp;gt;IDENTIFIED BY &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Redmineのダウンロード ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd&lt;br /&gt;
$ wget http://www.redmine.org/releases/redmine-3.4.3.tar.gz&lt;br /&gt;
$ tar -zxvf redmine-3.4.3.tar.gz&lt;br /&gt;
$ sudo mkdir &amp;lt;PARENT_REDMINE_DIR&amp;gt;&lt;br /&gt;
$ sudo mv redmine-3.4.3 &amp;lt;PARENT_REDMINE_DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== データベースへの接続設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd &amp;lt;REDMINE_DIR&amp;gt;&lt;br /&gt;
$ cp config/database.yml.example config/database.yml&lt;br /&gt;
$ vim config/database.yml&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下を編集&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
production:&lt;br /&gt;
  adapter: mysql2&lt;br /&gt;
  database: &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
  host: &amp;lt;HOST&amp;gt;&lt;br /&gt;
  username: &amp;lt;USER_NAME&amp;gt;&lt;br /&gt;
  password: &amp;quot;&amp;lt;PASSWORD&amp;gt;&amp;quot;&lt;br /&gt;
  encoding: utf8&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
他はコメントアウト&lt;br /&gt;
&lt;br /&gt;
=== gemパッケージのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ bundle install --without development test&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
エラー発生&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
mysql client is missing. You may need to &#039;apt-get install libmysqlclient-dev&#039; or &#039;yum install mysql-devel&#039;, and try&lt;br /&gt;
again.&lt;br /&gt;
...&lt;br /&gt;
An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue.&lt;br /&gt;
Make sure that `gem install mysql2 -v &#039;0.4.10&#039;` succeeds before bundling.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y libmysqlclient-dev&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
エラー発生&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
E: パッケージ &#039;libmysqlclient-dev&#039; にはインストール候補がありません&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
代わりにlibmariadbd-devをインストール&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y libmariadbd-dev&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
で、忘れそうになるけど、やりたかったのはこれ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ bundle install --without development test&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== セッション改ざん防止用秘密鍵の作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ bundle exec rake generate_secret_token&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== バックアップデータをDBに流す ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mysql -u &amp;lt;USER_NAME&amp;gt; -p&amp;lt;PASSWORD&amp;gt; -D &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Passengerのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo gem install passenger --no-rdoc --no-ri&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== PassengerのApache用モジュールのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo passenger-install-apache2-module --auto --languages ruby&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
エラー発生&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
 * Checking for Curl development headers with SSL support...&lt;br /&gt;
      Found: no&lt;br /&gt;
      Error: Cannot find the `curl-config` command.&lt;br /&gt;
...&lt;br /&gt;
 * Checking for OpenSSL development headers...&lt;br /&gt;
      Found: no&lt;br /&gt;
...&lt;br /&gt;
Installation instructions for required software&lt;br /&gt;
&lt;br /&gt;
 * To install Curl development headers with SSL support:&lt;br /&gt;
   Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer.&lt;br /&gt;
&lt;br /&gt;
 * To install OpenSSL development headers:&lt;br /&gt;
   Please install it with apt-get install libssl-dev&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
libcurl4-openssl-devとlibssl-devをインストールすればいいらしい&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo apt install -y libcurl4-openssl-dev libssl-dev&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
あらためて&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo passenger-install-apache2-module --auto --languages ruby&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Apache用設定内容の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ passenger-install-apache2-module --snippet&lt;br /&gt;
LoadModule passenger_module /var/lib/gems/2.3.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so&lt;br /&gt;
&amp;lt;IfModule mod_passenger.c&amp;gt;&lt;br /&gt;
  PassengerRoot /var/lib/gems/2.3.0/gems/passenger-5.1.12&lt;br /&gt;
  PassengerDefaultRuby /usr/bin/ruby2.3&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Apacheの設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo vim /etc/apache2/conf-available/redmine.conf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下の内容を記載&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;Directory &amp;quot;&amp;lt;REDMINE_DIR&amp;gt;/public&amp;quot;&amp;gt;&lt;br /&gt;
  Require all granted&lt;br /&gt;
&amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LoadModule passenger_module /var/lib/gems/2.3.0/gems/passenger-5.1.12/buildout/apache2/mod_passenger.so&lt;br /&gt;
&amp;lt;IfModule mod_passenger.c&amp;gt;&lt;br /&gt;
  PassengerRoot /var/lib/gems/2.3.0/gems/passenger-5.1.12&lt;br /&gt;
  PassengerDefaultRuby /usr/bin/ruby2.3&lt;br /&gt;
&amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
設定を反映&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo a2enconf redmine&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
邪魔なconfをdisableに&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo a2dissite 000-default.conf&lt;br /&gt;
$ sudo systemctl reload apache2&lt;br /&gt;
$ sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/&amp;lt;CONF_FILE_NAME&amp;gt;.conf&lt;br /&gt;
$ sudo vim /etc/apache2/sites-available/&amp;lt;CONF_FILE_NAME&amp;gt;.conf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下の内容を記載&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;apache&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
        # The ServerName directive sets the request scheme, hostname and port that&lt;br /&gt;
        # the server uses to identify itself. This is used when creating&lt;br /&gt;
        # redirection URLs. In the context of virtual hosts, the ServerName&lt;br /&gt;
        # specifies what hostname must appear in the request&#039;s Host: header to&lt;br /&gt;
        # match this virtual host. For the default virtual host (this file) this&lt;br /&gt;
        # value is not decisive as it is used as a last resort host regardless.&lt;br /&gt;
        # However, you must set it for any further virtual host explicitly.&lt;br /&gt;
        ServerName &amp;lt;DOMAIN&amp;gt;&lt;br /&gt;
        ServerAdmin &amp;lt;MAIL_ADDRESS&amp;gt;&lt;br /&gt;
        DocumentRoot &amp;lt;REDMINE_DIR&amp;gt;/public&lt;br /&gt;
&lt;br /&gt;
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,&lt;br /&gt;
        # error, crit, alert, emerg.&lt;br /&gt;
        # It is also possible to configure the loglevel for particular&lt;br /&gt;
        # modules, e.g.&lt;br /&gt;
        #LogLevel info ssl:warn&lt;br /&gt;
&lt;br /&gt;
        ErrorLog ${APACHE_LOG_DIR}/error.log&lt;br /&gt;
        CustomLog ${APACHE_LOG_DIR}/access.log combined&lt;br /&gt;
&lt;br /&gt;
        # For most configuration files from conf-available/, which are&lt;br /&gt;
        # enabled or disabled at a global level, it is possible to&lt;br /&gt;
        # include a line for only one particular virtual host. For example the&lt;br /&gt;
        # following line enables the CGI configuration for this host only&lt;br /&gt;
        # after it has been globally disabled with &amp;quot;a2disconf&amp;quot;.&lt;br /&gt;
        #Include conf-available/serve-cgi-bin.conf&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
設定を反映&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo a2ensite &amp;lt;CONF_FILE_NAME&amp;gt;&lt;br /&gt;
$ sudo systemctl reload apache2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== プラグインの復旧 ===&lt;br /&gt;
==== redmine_absolute_dates ====&lt;br /&gt;
日時表記を相対値から絶対値にするやつ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mv &amp;lt;PLUGIN_PATH&amp;gt; &amp;lt;REDMINE_DIR&amp;gt;/plugin/.&lt;br /&gt;
$ touch &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Redmineにアクセスすると再起動完了&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ rm &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== redmine_issue_templates ====&lt;br /&gt;
チケット作成時にテンプレートを適用するやつ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mv &amp;lt;PLUGIN_PATH&amp;gt; &amp;lt;REDMINE_DIR&amp;gt;/plugin/.&lt;br /&gt;
$ touch &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Redmineにアクセスすると再起動完了&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ rm &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== redmine_knowledgebase ====&lt;br /&gt;
ナレッジベース&amp;lt;br /&amp;gt;&lt;br /&gt;
新規に追加することはないだろうけど、過去に使ってたから一応&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mv &amp;lt;PLUGIN_PATH&amp;gt; &amp;lt;REDMINE_DIR&amp;gt;/plugin/.&lt;br /&gt;
$ bundle install&lt;br /&gt;
$ touch &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Redmineにアクセスすると再起動完了&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ rm &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ディレクトリの所有者を変更してmigrate ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo chown -R www-data:www-data &amp;lt;PARENT_REDMINE_DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;REDMINE_DIR&amp;gt;&lt;br /&gt;
$ sudo -u www-data bundle install&lt;br /&gt;
$ sudo -u www-data RAILS_ENV=production bundle exec rake db:migrate&lt;br /&gt;
$ sudo systemctl reload apache2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== メール通知の設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo -u www-data cp &amp;lt;REDMINE_DIR&amp;gt;/config/configuration.yml.example &amp;lt;REDMINE_DIR&amp;gt;/config/configuration.yml&lt;br /&gt;
$ sudo vim &amp;lt;REDMINE_DIR&amp;gt;/config/configuration.yml&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下を記載&amp;lt;br /&amp;gt;&lt;br /&gt;
（outlook.comのサーバーを使用することを想定）&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;YAML&amp;quot;&amp;gt;&lt;br /&gt;
production:&lt;br /&gt;
  email_delivery:&lt;br /&gt;
    delivery_method: :smtp&lt;br /&gt;
    smtp_settings:&lt;br /&gt;
      enable_starttls_auto: true&lt;br /&gt;
      address: &amp;quot;&amp;lt;SMTP_SERVER&amp;gt;&amp;quot;&lt;br /&gt;
      port: 587&lt;br /&gt;
      domain: &amp;quot;&amp;lt;DOMAIN&amp;gt;&amp;quot;&lt;br /&gt;
      authentication: :login&lt;br /&gt;
      user_name: &amp;quot;&amp;lt;USER_NAME&amp;gt;&amp;quot;&lt;br /&gt;
      password: &amp;quot;&amp;lt;PASSWORD&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo -u www-data touch &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Redmineにアクセスすると再起動完了&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sudo -u www-data rm &amp;lt;REDMINE_DIR&amp;gt;/tmp/restart.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:RaspBerryPi]]&lt;br /&gt;
[[Category:Raspbian]]&lt;br /&gt;
[[Category:Stretch]]&lt;br /&gt;
[[Category:Redmine]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=157</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=157"/>
		<updated>2025-10-25T19:21:42Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== remote ===&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote add &amp;lt;REMOTE_NAME&amp;gt; &amp;lt;REPOSITORY&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote rm &amp;lt;REMOTE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 名前変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote rename &amp;lt;OLOD_NAME&amp;gt; &amp;lt;NEW_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== Git2.27.0以降でのwarning ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
hint: Pulling without specifying how to reconcile divergent branches is&lt;br /&gt;
hint: discouraged. You can squelch this message by running one of the following&lt;br /&gt;
hint: commands sometime before your next pull:&lt;br /&gt;
hint:&lt;br /&gt;
hint:   git config pull.rebase false  # merge (the default strategy)&lt;br /&gt;
hint:   git config pull.rebase true   # rebase&lt;br /&gt;
hint:   git config pull.ff only       # fast-forward only&lt;br /&gt;
hint:&lt;br /&gt;
hint: You can replace &amp;quot;git config&amp;quot; with &amp;quot;git config --global&amp;quot; to set a default&lt;br /&gt;
hint: preference for all repositories. You can also pass --rebase, --no-rebase,&lt;br /&gt;
hint: or --ff-only on the command line to override the configured default per&lt;br /&gt;
hint: invocation.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fetch + merge（デフォルト） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fetch + rebase =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fast-forwardのみ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 別名でpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push origin &amp;lt;LOCAL_BRANCH&amp;gt;:&amp;lt;REMOTE_BRANCH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=156</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=156"/>
		<updated>2022-01-18T02:43:28Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== remote ===&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote add &amp;lt;REMOTE_NAME&amp;gt; &amp;lt;REPOSITORY&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote rm &amp;lt;REMOTE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 名前変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote rename &amp;lt;OLOD_NAME&amp;gt; &amp;lt;NEW_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== Git2.27.0以降でのwarning ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hint: Pulling without specifying how to reconcile divergent branches is&lt;br /&gt;
hint: discouraged. You can squelch this message by running one of the following&lt;br /&gt;
hint: commands sometime before your next pull:&lt;br /&gt;
hint:&lt;br /&gt;
hint:   git config pull.rebase false  # merge (the default strategy)&lt;br /&gt;
hint:   git config pull.rebase true   # rebase&lt;br /&gt;
hint:   git config pull.ff only       # fast-forward only&lt;br /&gt;
hint:&lt;br /&gt;
hint: You can replace &amp;quot;git config&amp;quot; with &amp;quot;git config --global&amp;quot; to set a default&lt;br /&gt;
hint: preference for all repositories. You can also pass --rebase, --no-rebase,&lt;br /&gt;
hint: or --ff-only on the command line to override the configured default per&lt;br /&gt;
hint: invocation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===== fetch + merge（デフォルト） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fetch + rebase =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fast-forwardのみ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 別名でpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push origin &amp;lt;LOCAL_BRANCH&amp;gt;:&amp;lt;REMOTE_BRANCH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=155</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=155"/>
		<updated>2022-01-18T01:16:00Z</updated>

		<summary type="html">&lt;p&gt;371: /* push */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== Git2.27.0以降でのwarning ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hint: Pulling without specifying how to reconcile divergent branches is&lt;br /&gt;
hint: discouraged. You can squelch this message by running one of the following&lt;br /&gt;
hint: commands sometime before your next pull:&lt;br /&gt;
hint:&lt;br /&gt;
hint:   git config pull.rebase false  # merge (the default strategy)&lt;br /&gt;
hint:   git config pull.rebase true   # rebase&lt;br /&gt;
hint:   git config pull.ff only       # fast-forward only&lt;br /&gt;
hint:&lt;br /&gt;
hint: You can replace &amp;quot;git config&amp;quot; with &amp;quot;git config --global&amp;quot; to set a default&lt;br /&gt;
hint: preference for all repositories. You can also pass --rebase, --no-rebase,&lt;br /&gt;
hint: or --ff-only on the command line to override the configured default per&lt;br /&gt;
hint: invocation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===== fetch + merge（デフォルト） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fetch + rebase =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fast-forwardのみ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 別名でpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push origin &amp;lt;LOCAL_BRANCH&amp;gt;:&amp;lt;REMOTE_BRANCH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=154</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=154"/>
		<updated>2021-02-02T06:25:01Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パスワード ===&lt;br /&gt;
==== 変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD NULL;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER DATABASE &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== column ==&lt;br /&gt;
=== 追加 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ADD COLUMN &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;COLUMN_TYPE&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or 特定のカラムの後に追加&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ADD COLUMN &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;COLUMN_TYPE&amp;gt; AFTER &amp;lt;EXISTING_COLUMN_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 型変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ALTER COLUMN &amp;lt;COLUMN_NAME&amp;gt; TYPE &amp;lt;NEW_COLUMN_TYPE&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; DROP COLUMN &amp;lt;COLUMN_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 複製 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump　-n &amp;lt;SOURCE_SCHEMA_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;NEW_SCHEMA_NAME&amp;gt; RENAME TO &amp;lt;SOURCE_SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ほか ==&lt;br /&gt;
=== 複数カラムの組み合わせで重複しているレコードを抽出 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
      * &lt;br /&gt;
FROM&lt;br /&gt;
    &amp;lt;TABLE&amp;gt;&lt;br /&gt;
WHERE&lt;br /&gt;
    (&amp;lt;COLUMN_1&amp;gt;, &amp;lt;COLUMN_2&amp;gt;) IN ( &lt;br /&gt;
        SELECT DISTINCT&lt;br /&gt;
              &amp;lt;COLUMN_1&amp;gt;&lt;br /&gt;
            , &amp;lt;COLUMN_2&amp;gt;&lt;br /&gt;
        FROM&lt;br /&gt;
            &amp;lt;TABLE&amp;gt;&lt;br /&gt;
        GROUP BY&lt;br /&gt;
            &amp;lt;COLUMN_1&amp;gt;&lt;br /&gt;
            , &amp;lt;COLUMN_2&amp;gt;&lt;br /&gt;
        HAVING&lt;br /&gt;
            count(&amp;lt;COLUMN_1&amp;gt;) &amp;gt; 1 &lt;br /&gt;
            AND count(&amp;lt;COLUMN_2&amp;gt;) &amp;gt; 1&lt;br /&gt;
    ) &lt;br /&gt;
ORDER BY&lt;br /&gt;
    &amp;lt;COLUMN_1&amp;gt;&lt;br /&gt;
    , &amp;lt;COLUMN_2&amp;gt;&lt;br /&gt;
;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=153</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=153"/>
		<updated>2021-02-02T02:59:17Z</updated>

		<summary type="html">&lt;p&gt;371: /* pull */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== Git2.27.0以降でのwarning ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hint: Pulling without specifying how to reconcile divergent branches is&lt;br /&gt;
hint: discouraged. You can squelch this message by running one of the following&lt;br /&gt;
hint: commands sometime before your next pull:&lt;br /&gt;
hint:&lt;br /&gt;
hint:   git config pull.rebase false  # merge (the default strategy)&lt;br /&gt;
hint:   git config pull.rebase true   # rebase&lt;br /&gt;
hint:   git config pull.ff only       # fast-forward only&lt;br /&gt;
hint:&lt;br /&gt;
hint: You can replace &amp;quot;git config&amp;quot; with &amp;quot;git config --global&amp;quot; to set a default&lt;br /&gt;
hint: preference for all repositories. You can also pass --rebase, --no-rebase,&lt;br /&gt;
hint: or --ff-only on the command line to override the configured default per&lt;br /&gt;
hint: invocation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
===== fetch + merge（デフォルト） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fetch + rebase =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.rebase true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== fast-forwardのみ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global pull.ff only &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=152</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=152"/>
		<updated>2021-01-20T10:15:09Z</updated>

		<summary type="html">&lt;p&gt;371: /* コメント入力をvimに変更 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=151</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=151"/>
		<updated>2021-01-20T10:14:20Z</updated>

		<summary type="html">&lt;p&gt;371: /* config関連 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== コメント入力をvimに変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.editor vim&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=150</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=150"/>
		<updated>2020-10-16T15:33:00Z</updated>

		<summary type="html">&lt;p&gt;371: /* まとめ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== watch関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias watch=&#039;watch -c -n 1 &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
alias watch=&#039;watch -c -n 1 &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=149</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=149"/>
		<updated>2020-10-16T15:32:52Z</updated>

		<summary type="html">&lt;p&gt;371: /* watch関連 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== watch関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias watch=&#039;watch -c -n 1 &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
alias watch=&#039;watch &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=148</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=148"/>
		<updated>2020-10-16T15:24:57Z</updated>

		<summary type="html">&lt;p&gt;371: /* まとめ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== watch関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias watch=&#039;watch &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
alias watch=&#039;watch &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=147</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=147"/>
		<updated>2020-10-16T15:24:46Z</updated>

		<summary type="html">&lt;p&gt;371: /* alias集 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== watch関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias watch=&#039;watch &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E7%A7%98%E5%AF%86%E9%8D%B5%E3%83%BB%E5%85%AC%E9%96%8B%E9%8D%B5&amp;diff=146</id>
		<title>秘密鍵・公開鍵</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E7%A7%98%E5%AF%86%E9%8D%B5%E3%83%BB%E5%85%AC%E9%96%8B%E9%8D%B5&amp;diff=146"/>
		<updated>2020-10-08T23:49:26Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== 概要 ===&lt;br /&gt;
* ~/.ssh&lt;br /&gt;
** permission : 700&lt;br /&gt;
** 基本的に秘密鍵や公開鍵を置いておくところ。&lt;br /&gt;
* id_rsa&lt;br /&gt;
** permission : 600&lt;br /&gt;
** 秘密鍵&lt;br /&gt;
** 誰にも渡しちゃダメ。&lt;br /&gt;
* id_rsa.pub&lt;br /&gt;
** permission : 600（一応、600。どうせ消すのでなんでもいい。）&lt;br /&gt;
** 公開鍵&lt;br /&gt;
** 登録するすべてのサーバーの authorized_keys に内容を追記。&lt;br /&gt;
** authorized_keys に登録後はこの世から抹消してよい。&lt;br /&gt;
** 必要になったらまた id_rsa から作れる。&lt;br /&gt;
* authorized_keys&lt;br /&gt;
** permission : 600&lt;br /&gt;
** 登録された id_rsa.pub の内容が記載される。&lt;br /&gt;
* ~/.ssh/config&lt;br /&gt;
** permission : 600&lt;br /&gt;
** ssh接続の設定を保存しておく。&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵・公開鍵の作成 ===&lt;br /&gt;
クライアント、サーバーのどちらで作ってもよいがクライアント側で作成した方が無難？&amp;lt;br /&amp;gt;&lt;br /&gt;
サーバー側で作成したら削除するのが普通。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
$ ssh-keygen -t rsa -b 4096 -C &amp;quot;&amp;lt;COMMENT&amp;gt;&amp;quot; -f ~/.ssh/id_rsa&lt;br /&gt;
Generating public/private rsa key pair.&lt;br /&gt;
Enter passphrase (empty for no passphrase): ←何も入力しないのもあり&lt;br /&gt;
Enter same passphrase again:&lt;br /&gt;
Your identification has been saved in &amp;lt;ID_RSA_PATH&amp;gt;&lt;br /&gt;
Your public key has been saved in &amp;lt;ID_RSA.PUB_PATH&amp;gt;&lt;br /&gt;
The key fingerprint is:&lt;br /&gt;
SHA256:&amp;lt;NANIKA_MOJIRETSU&amp;gt;&lt;br /&gt;
The key&#039;s randomart image is:&lt;br /&gt;
+---[RSA 4096]----+ ←適当なこんなのが表示される&lt;br /&gt;
|  o  o           |&lt;br /&gt;
|      oo         |&lt;br /&gt;
|           ..o   |&lt;br /&gt;
| o   .oo.        |&lt;br /&gt;
|   . .o  o . +o  |&lt;br /&gt;
| .o      . * o.+ |&lt;br /&gt;
|oo      o o = .. |&lt;br /&gt;
| .*=   + .  oo   |&lt;br /&gt;
| .*        o=  +o|&lt;br /&gt;
+----[SHA256]-----+&lt;br /&gt;
&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== サーバーの設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
scp なりなんなりで authorized_keys を ~/.ssh/. に配置&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cat ~/.ssh/id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
$ chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
$ rm ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
登録するサーバーの数だけこれを繰り返す。&lt;br /&gt;
&lt;br /&gt;
=== クライアントの設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
scp なりなんなりで id_rsa を ~/.ssh/. に配置&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵から公開鍵を作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ ssh-keygen -y -f ~/.ssh/id_rsa &amp;gt; ~/.ssh/id_rsa.pub&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵と公開鍵の認証で ssh ログインするための設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ vim /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下のように修正&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
PasswordAuthentication no&lt;br /&gt;
sshのログイン時にidとpasswordでのログインを認めない。（秘密鍵を使った認証しか認めない。）&lt;br /&gt;
&lt;br /&gt;
PermitEmptyPasswords no&lt;br /&gt;
空のパスワードを認めない。秘密鍵のパスワードは空でもOK。&lt;br /&gt;
&lt;br /&gt;
ChallengeResponseAuthentication no&lt;br /&gt;
チャレンジレスポンス認証を認めない。これを yes にすると PasswordAuthentication no にした意味がなくなる。&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
あとは通常デフォルト値で問題ないはず。&lt;br /&gt;
&lt;br /&gt;
=== ~/.ssh/config ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ touch ~/.ssh/config&lt;br /&gt;
$ chmod 600 ~/.ssh/config&lt;br /&gt;
$ vim ~/.ssh/config&lt;br /&gt;
Host &amp;lt;NANTOKAKANTOKA&amp;gt;&lt;br /&gt;
    HostName &amp;lt;domain.com&amp;gt;&lt;br /&gt;
    IdentityFile &amp;lt;ID_RSA_PATH&amp;gt;&lt;br /&gt;
    User &amp;lt;USER_NAME&amp;gt;&lt;br /&gt;
    TCPKeepAlive yes&lt;br /&gt;
    Port &amp;lt;PORT&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E7%A7%98%E5%AF%86%E9%8D%B5%E3%83%BB%E5%85%AC%E9%96%8B%E9%8D%B5&amp;diff=145</id>
		<title>秘密鍵・公開鍵</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E7%A7%98%E5%AF%86%E9%8D%B5%E3%83%BB%E5%85%AC%E9%96%8B%E9%8D%B5&amp;diff=145"/>
		<updated>2020-10-07T17:02:17Z</updated>

		<summary type="html">&lt;p&gt;371: ページの作成:「=== 概要 === * ~/.ssh ** permission : 700 ** 基本的に秘密鍵や公開鍵を置いておくところ。 * id_rsa ** permission : 600 ** 秘密鍵 ** 誰にも渡...」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== 概要 ===&lt;br /&gt;
* ~/.ssh&lt;br /&gt;
** permission : 700&lt;br /&gt;
** 基本的に秘密鍵や公開鍵を置いておくところ。&lt;br /&gt;
* id_rsa&lt;br /&gt;
** permission : 600&lt;br /&gt;
** 秘密鍵&lt;br /&gt;
** 誰にも渡しちゃダメ。&lt;br /&gt;
* id_rsa.pub&lt;br /&gt;
** permission : 600（一応、600。どうせ消すのでなんでもいい。）&lt;br /&gt;
** 公開鍵&lt;br /&gt;
** 登録するすべてのサーバーの authorized_keys に内容を追記。&lt;br /&gt;
** authorized_keys に登録後はこの世から抹消してよい。&lt;br /&gt;
** 必要になったらまた id_rsa から作れる。&lt;br /&gt;
* authorized_keys&lt;br /&gt;
** permission : 600&lt;br /&gt;
** 登録された id_rsa.pub の内容が記載される。&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵・公開鍵の作成 ===&lt;br /&gt;
クライアント、サーバーのどちらで作ってもよいがクライアント側で作成した方が無難？&amp;lt;br /&amp;gt;&lt;br /&gt;
サーバー側で作成したら削除するのが普通。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
$ ssh-keygen -t rsa -b 4096 -C &amp;quot;&amp;lt;COMMENT&amp;gt;&amp;quot; -f ~/.ssh/id_rsa&lt;br /&gt;
Generating public/private rsa key pair.&lt;br /&gt;
Enter passphrase (empty for no passphrase): ←何も入力しないのもあり&lt;br /&gt;
Enter same passphrase again:&lt;br /&gt;
Your identification has been saved in &amp;lt;ID_RSA_PATH&amp;gt;&lt;br /&gt;
Your public key has been saved in &amp;lt;ID_RSA.PUB_PATH&amp;gt;&lt;br /&gt;
The key fingerprint is:&lt;br /&gt;
SHA256:&amp;lt;NANIKA_MOJIRETSU&amp;gt;&lt;br /&gt;
The key&#039;s randomart image is:&lt;br /&gt;
+---[RSA 4096]----+ ←適当なこんなのが表示される&lt;br /&gt;
|  o  o           |&lt;br /&gt;
|      oo         |&lt;br /&gt;
|           ..o   |&lt;br /&gt;
| o   .oo.        |&lt;br /&gt;
|   . .o  o . +o  |&lt;br /&gt;
| .o      . * o.+ |&lt;br /&gt;
|oo      o o = .. |&lt;br /&gt;
| .*=   + .  oo   |&lt;br /&gt;
| .*        o=  +o|&lt;br /&gt;
+----[SHA256]-----+&lt;br /&gt;
&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== サーバーの設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
scp なりなんなりで authorized_keys を ~/.ssh/. に配置&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cat ~/.ssh/id_rsa.pub &amp;gt;&amp;gt; authorized_keys&lt;br /&gt;
$ chmod 600 ~/.ssh/authorized_keys&lt;br /&gt;
$ rm ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
登録するサーバーの数だけこれを繰り返す。&lt;br /&gt;
&lt;br /&gt;
=== クライアントの設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir -p ~/.ssh&lt;br /&gt;
$ chmod 700 ~/.ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
scp なりなんなりで id_rsa を ~/.ssh/. に配置&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵から公開鍵を作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ ssh-keygen -y -f ~/.ssh/id_rsa &amp;gt; ~/.ssh/id_rsa.pub&lt;br /&gt;
$ chmod 600 ~/.ssh/id_rsa.pub&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 秘密鍵と公開鍵の認証で ssh ログインするための設定 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ vim /etc/ssh/sshd_config&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
以下のように修正&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
PasswordAuthentication no&lt;br /&gt;
sshのログイン時にidとpasswordでのログインを認めない。（秘密鍵を使った認証しか認めない。）&lt;br /&gt;
&lt;br /&gt;
PermitEmptyPasswords no&lt;br /&gt;
空のパスワードを認めない。秘密鍵のパスワードは空でもOK。&lt;br /&gt;
&lt;br /&gt;
ChallengeResponseAuthentication no&lt;br /&gt;
チャレンジレスポンス認証を認めない。これを yes にすると PasswordAuthentication no にした意味がなくなる。&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
あとは通常デフォルト値で問題ないはず。&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%A8%E5%AF%BE%E7%AD%96%E9%9B%86&amp;diff=144</id>
		<title>Vagrantのエラーと対策集</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC%E3%81%A8%E5%AF%BE%E7%AD%96%E9%9B%86&amp;diff=144"/>
		<updated>2020-09-25T16:27:42Z</updated>

		<summary type="html">&lt;p&gt;371: ページの作成:「=== Boxをダウンロードできずエラー404 === * エラー &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt; $ vagrant up  ...  URL: [&amp;quot;https://atlas.hashicorp.com/nanntoka/kanntoka&amp;quot;]...」&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Boxをダウンロードできずエラー404 ===&lt;br /&gt;
* エラー&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ vagrant up&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
URL: [&amp;quot;https://atlas.hashicorp.com/nanntoka/kanntoka&amp;quot;]&lt;br /&gt;
Error: The requested URL returned error: 404 Not Found&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* 原因&lt;br /&gt;
いつからか https://atlas.hashicorp.com/ が使われなくなったらしい。&amp;lt;br /&amp;gt;&lt;br /&gt;
https://vagrantcloud.com になったらしい。&lt;br /&gt;
* 対策&lt;br /&gt;
Vagrantfileの先頭行に以下を挿入&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
Vagrant::DEFAULT_SERVER_URL.replace(&#039;https://vagrantcloud.com&#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=143</id>
		<title>Vagrantでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=143"/>
		<updated>2020-08-03T04:31:34Z</updated>

		<summary type="html">&lt;p&gt;371: /* 出力 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== box ===&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box add &amp;lt;BOX_NAME&amp;gt; &amp;lt;PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box remove &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 出力 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant package --output &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 操作 ===&lt;br /&gt;
==== 初期化 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box init &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant up&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 再起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 終了 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant halt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 破棄 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant destroy&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== sshで接続 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:仮想環境]]&lt;br /&gt;
[[Category:Vagrant]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=142</id>
		<title>Vagrantでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=142"/>
		<updated>2020-08-03T04:30:09Z</updated>

		<summary type="html">&lt;p&gt;371: /* 出直 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== box ===&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box add &amp;lt;BOX_NAME&amp;gt; &amp;lt;PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box remove &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 出力 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant package --output &amp;lt;NEW_BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 操作 ===&lt;br /&gt;
==== 初期化 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box init &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant up&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 再起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 終了 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant halt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 破棄 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant destroy&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== sshで接続 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:仮想環境]]&lt;br /&gt;
[[Category:Vagrant]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=141</id>
		<title>Vagrantでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=141"/>
		<updated>2020-08-03T04:29:32Z</updated>

		<summary type="html">&lt;p&gt;371: /* box */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== box ===&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box add &amp;lt;BOX_NAME&amp;gt; &amp;lt;PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box remove &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 出直 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant package --output &amp;lt;NEW_BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 操作 ===&lt;br /&gt;
==== 初期化 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant box init &amp;lt;BOX_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant up&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 再起動 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 終了 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant halt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 破棄 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant destroy&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== sshで接続 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant ssh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:仮想環境]]&lt;br /&gt;
[[Category:Vagrant]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=140</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=140"/>
		<updated>2020-07-01T08:27:32Z</updated>

		<summary type="html">&lt;p&gt;371: /* 新しくブランチをremoteから持ってくる */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origin/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=139</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=139"/>
		<updated>2020-02-28T04:39:27Z</updated>

		<summary type="html">&lt;p&gt;371: /* まとめ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=138</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=138"/>
		<updated>2020-02-28T04:39:11Z</updated>

		<summary type="html">&lt;p&gt;371: /* alias集 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== sudo ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias sudo=&#039;sudo &#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=137</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=137"/>
		<updated>2020-02-24T23:51:29Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パスワード ===&lt;br /&gt;
==== 変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD NULL;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER DATABASE &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== column ==&lt;br /&gt;
=== 追加 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ADD COLUMN &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;COLUMN_TYPE&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or 特定のカラムの後に追加&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ADD COLUMN &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;COLUMN_TYPE&amp;gt; AFTER &amp;lt;EXISTING_COLUMN_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 型変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; ALTER COLUMN &amp;lt;COLUMN_NAME&amp;gt; TYPE &amp;lt;NEW_COLUMN_TYPE&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER TABLE &amp;lt;TABLE_NAME&amp;gt; DROP COLUMN &amp;lt;COLUMN_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 複製 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump　-n &amp;lt;SOURCE_SCHEMA_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;NEW_SCHEMA_NAME&amp;gt; RENAME TO &amp;lt;SOURCE_SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=136</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=136"/>
		<updated>2020-02-07T04:37:37Z</updated>

		<summary type="html">&lt;p&gt;371: /* database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パスワード ===&lt;br /&gt;
==== 変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD NULL;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER DATABASE &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 複製 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump　-n &amp;lt;SOURCE_SCHEMA_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;NEW_SCHEMA_NAME&amp;gt; RENAME TO &amp;lt;SOURCE_SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=135</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=135"/>
		<updated>2020-02-07T04:34:16Z</updated>

		<summary type="html">&lt;p&gt;371: /* role */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パスワード ===&lt;br /&gt;
==== 変更 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;ROLE_NAME&amp;gt; WITH PASSWORD NULL;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 複製 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump　-n &amp;lt;SOURCE_SCHEMA_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;NEW_SCHEMA_NAME&amp;gt; RENAME TO &amp;lt;SOURCE_SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=134</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=134"/>
		<updated>2020-01-10T02:13:54Z</updated>

		<summary type="html">&lt;p&gt;371: /* schema */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 複製 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump　-n &amp;lt;SOURCE_SCHEMA_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;NEW_SCHEMA_NAME&amp;gt; RENAME TO &amp;lt;SOURCE_SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=133</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=133"/>
		<updated>2019-08-16T01:47:00Z</updated>

		<summary type="html">&lt;p&gt;371: /* commit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 空のcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=132</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=132"/>
		<updated>2019-08-16T01:43:24Z</updated>

		<summary type="html">&lt;p&gt;371: /* commit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 無言でcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --allow-empty-message -m &amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=131</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=131"/>
		<updated>2019-08-16T01:29:19Z</updated>

		<summary type="html">&lt;p&gt;371: /* 新しくブランチを持ってくる */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチをremoteから持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=130</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=130"/>
		<updated>2019-08-16T01:28:09Z</updated>

		<summary type="html">&lt;p&gt;371: /* commit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
==== とりあえずcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでcommit ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== commitの修正 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --amend&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=129</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=129"/>
		<updated>2019-08-16T01:19:29Z</updated>

		<summary type="html">&lt;p&gt;371: /* push */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
==== とりあえずpush ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== dry run ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push --dry-run&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push -n&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=128</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=128"/>
		<updated>2019-08-16T01:08:25Z</updated>

		<summary type="html">&lt;p&gt;371: /* clone */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
==== とりあえずclone ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ディレクトリ指定 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt; &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push &amp;lt;REMOTE&amp;gt; &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=127</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=127"/>
		<updated>2019-08-16T01:07:29Z</updated>

		<summary type="html">&lt;p&gt;371: /* pull */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
==== とりあえずpull ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push &amp;lt;REMOTE&amp;gt; &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=126</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=126"/>
		<updated>2019-08-16T01:06:30Z</updated>

		<summary type="html">&lt;p&gt;371: /* fetch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
==== とりあえずfetch ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== remoteで削除されたブランチをローカルでも削除 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or remoteで削除されたブランチをローカルでも削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push &amp;lt;REMOTE&amp;gt; &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=125</id>
		<title>Gitでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Git%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=125"/>
		<updated>2019-08-16T01:04:37Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== リポジトリの作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ cd &amp;lt;DIR&amp;gt;&lt;br /&gt;
$ git init --bare --shared&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clone ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git clone &amp;lt;REPOSITORY_PATH&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== fetch ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or remoteで削除されたブランチをローカルでも削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git fetch --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== pull ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or remoteで削除されたブランチをローカルでも削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git pull --prune&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 変更の確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== add ===&lt;br /&gt;
==== とりあえず全部 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -A&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新規作成 or 変更されたもの ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add .&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更があったもののみ ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git add -u&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== commit ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git commit -m &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== push ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git push &amp;lt;REMOTE&amp;gt; &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== merge ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git merge &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== branch確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git branch -a&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== checkout ===&lt;br /&gt;
==== 特定のコミットをcheckout ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;COMMIT_ID&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== ブランチ切り替え ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout &amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 新しくブランチを持ってくる ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
e.g&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git checkout -b develop origen/develop&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== checkoutできないとき ====&lt;br /&gt;
エラー内容&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
fatal: git checkout: updating paths is incompatible with switching branches.&lt;br /&gt;
Did you intend to checkout &#039;origin/remote-name&#039; which can not be resolved as commit?&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
こうする&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git remote show &amp;lt;REMOTE&amp;gt;&lt;br /&gt;
$ git remote update&lt;br /&gt;
$ git fetch&lt;br /&gt;
$ git checkout -b &amp;lt;BRANCH_NAME&amp;gt; &amp;lt;REMOTE&amp;gt;/&amp;lt;BRANCH_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== stash ===&lt;br /&gt;
==== とりあえず面倒なとき ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== メッセージ付きでstash ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash save &amp;quot;&amp;lt;MESSAGE&amp;gt;&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 一覧 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git stash list&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== log ===&lt;br /&gt;
==== 1行表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== グラフィカル表示 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --graph&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 追加/削除行数 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --numstat&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 変更したファイル ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --name-status&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 絞り込み ====&lt;br /&gt;
===== 期間（相対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;10 days ago&amp;quot; --until=&amp;quot;2 days ago&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 期間（絶対値） =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --since=&amp;quot;2019/03/01&amp;quot; --until=&amp;quot;2019/03/03&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 件数 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log -1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== ファイル =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log ./dokokanoDIR/nanikanoFILE&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== 人 =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --author=&#039;dareka&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== コミットログ =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --grep=&#039;コメント&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミット =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===== マージコミットを除く =====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --no-merges&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== format ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --pretty=format:&amp;quot;[%ad] %h %an : %s&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|パラメーター &lt;br /&gt;
!|説明&lt;br /&gt;
|-&lt;br /&gt;
|%H&lt;br /&gt;
|コミットのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%h&lt;br /&gt;
|コミットのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%T&lt;br /&gt;
|ツリーのハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%t&lt;br /&gt;
|ツリーのハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%P&lt;br /&gt;
|親のハッシュ&lt;br /&gt;
|-&lt;br /&gt;
|%p&lt;br /&gt;
|親のハッシュ (短縮版)&lt;br /&gt;
|-&lt;br /&gt;
|%an&lt;br /&gt;
|Author の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ae&lt;br /&gt;
|Author のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%ad&lt;br /&gt;
|Author の日付 (-date= オプションに従った形式)&lt;br /&gt;
|-&lt;br /&gt;
|%ar&lt;br /&gt;
|Author の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%cn&lt;br /&gt;
|Committer の名前&lt;br /&gt;
|-&lt;br /&gt;
|%ce&lt;br /&gt;
|Committer のメールアドレス&lt;br /&gt;
|-&lt;br /&gt;
|%cd&lt;br /&gt;
|Committer の日付&lt;br /&gt;
|-&lt;br /&gt;
|%cr&lt;br /&gt;
|Committer の相対日付&lt;br /&gt;
|-&lt;br /&gt;
|%s&lt;br /&gt;
|件名&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&#039;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== config関連 ===&lt;br /&gt;
==== Author ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config --global user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config --global user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config user.name &amp;lt;NAME&amp;gt;&lt;br /&gt;
$ git config user.email &amp;lt;EMAIL&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== permission変更を無視 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ git config core.filemode false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E5%AE%B9%E9%87%8F%E3%81%AE%E5%A2%97%E3%82%84%E3%81%97%E6%96%B9&amp;diff=124</id>
		<title>Vagrantのディスク容量の増やし方</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E5%AE%B9%E9%87%8F%E3%81%AE%E5%A2%97%E3%82%84%E3%81%97%E6%96%B9&amp;diff=124"/>
		<updated>2019-08-02T08:52:26Z</updated>

		<summary type="html">&lt;p&gt;371: /* ファイルシステムの拡張 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== 前提 ===&lt;br /&gt;
* host : Windows10&lt;br /&gt;
* guest : CentOS7&lt;br /&gt;
* VirtualBox&lt;br /&gt;
&lt;br /&gt;
=== pluginのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant plugin install vagrant-disksize&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== Vagrantfileの編集 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
config.vm.box = &amp;quot;nanikanonamae&amp;quot;&lt;br /&gt;
config.disksize.size = &#039;100GB&#039; # 追記&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== vagrant起動 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant up&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== sshでログインして状態確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk -l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パーティション作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk /dev/sda&lt;br /&gt;
n ← パーティション作成&lt;br /&gt;
p ← primaryを選択&lt;br /&gt;
3 ← パティーション番号（デフォでいいならEnter）&lt;br /&gt;
Enter ← パーティション開始位置（デフォでいいならEnter）&lt;br /&gt;
Enter ← パーティション終了位置（デフォでいいならEnter）&lt;br /&gt;
t ← タイプ変更&lt;br /&gt;
3 ← パティーション番号&lt;br /&gt;
8e ← 拡張したいパーティションと同じになるようにfdiskで確認した文字列&lt;br /&gt;
w ← 保存して終了&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 状態確認して再起動 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk -l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
/dev/sda3 みたいなのが追加されているはず&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or hostの方から&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== sshでログインして物理ボリューム作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# pvcreate /dev/sda3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== ボリュームグループに新しいパーティションを追加 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# vgextend centos /dev/sda3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ディスクの拡張 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# lvextend -l +100%FREE /dev/mapper/centos-root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ファイルシステムの拡張 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# xfs_growfs /dev/mapper/centos-root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or UbuntuとかDebianとか&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# resize2fs /dev/mapper/centos-root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 容量確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# df -h&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:linux]]&lt;br /&gt;
[[Category:仮想環境]]&lt;br /&gt;
[[Category:fdisk]]&lt;br /&gt;
[[Category:vagrant]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E5%AE%B9%E9%87%8F%E3%81%AE%E5%A2%97%E3%82%84%E3%81%97%E6%96%B9&amp;diff=123</id>
		<title>Vagrantのディスク容量の増やし方</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Vagrant%E3%81%AE%E3%83%87%E3%82%A3%E3%82%B9%E3%82%AF%E5%AE%B9%E9%87%8F%E3%81%AE%E5%A2%97%E3%82%84%E3%81%97%E6%96%B9&amp;diff=123"/>
		<updated>2019-08-02T08:52:16Z</updated>

		<summary type="html">&lt;p&gt;371: /* ディスクの拡張 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== 前提 ===&lt;br /&gt;
* host : Windows10&lt;br /&gt;
* guest : CentOS7&lt;br /&gt;
* VirtualBox&lt;br /&gt;
&lt;br /&gt;
=== pluginのインストール ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant plugin install vagrant-disksize&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== Vagrantfileの編集 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
config.vm.box = &amp;quot;nanikanonamae&amp;quot;&lt;br /&gt;
config.disksize.size = &#039;100GB&#039; # 追記&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== vagrant起動 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant up&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== sshでログインして状態確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk -l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== パーティション作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk /dev/sda&lt;br /&gt;
n ← パーティション作成&lt;br /&gt;
p ← primaryを選択&lt;br /&gt;
3 ← パティーション番号（デフォでいいならEnter）&lt;br /&gt;
Enter ← パーティション開始位置（デフォでいいならEnter）&lt;br /&gt;
Enter ← パーティション終了位置（デフォでいいならEnter）&lt;br /&gt;
t ← タイプ変更&lt;br /&gt;
3 ← パティーション番号&lt;br /&gt;
8e ← 拡張したいパーティションと同じになるようにfdiskで確認した文字列&lt;br /&gt;
w ← 保存して終了&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 状態確認して再起動 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# fdisk -l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
/dev/sda3 みたいなのが追加されているはず&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# reboot&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or hostの方から&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;dos&amp;quot;&amp;gt;&lt;br /&gt;
&amp;gt; vagrant reload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== sshでログインして物理ボリューム作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# pvcreate /dev/sda3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== ボリュームグループに新しいパーティションを追加 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# vgextend centos /dev/sda3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ディスクの拡張 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# lvextend -l +100%FREE /dev/mapper/centos-root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ファイルシステムの拡張 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# xfs_growfs /dev/mapper/centos/root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or UbuntuとかDebianとか&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# resize2fs /dev/mapper/centos/root&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 容量確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# df -h&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:linux]]&lt;br /&gt;
[[Category:仮想環境]]&lt;br /&gt;
[[Category:fdisk]]&lt;br /&gt;
[[Category:vagrant]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=122</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=122"/>
		<updated>2019-08-02T05:06:18Z</updated>

		<summary type="html">&lt;p&gt;371: /* dump/restore */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or schema指定&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -n &amp;lt;SCHEMA&amp;gt; &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=121</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=121"/>
		<updated>2019-07-18T04:57:04Z</updated>

		<summary type="html">&lt;p&gt;371: /* database */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ createdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DATABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ dropdb -U &amp;lt;ROLE_NAME&amp;gt; &amp;lt;DATABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=120</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=120"/>
		<updated>2019-07-18T04:54:50Z</updated>

		<summary type="html">&lt;p&gt;371: /* restore */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=119</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=119"/>
		<updated>2019-07-17T23:58:45Z</updated>

		<summary type="html">&lt;p&gt;371: /* 名前変更 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=118</id>
		<title>PostgreSQLでよくやること</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=PostgreSQL%E3%81%A7%E3%82%88%E3%81%8F%E3%82%84%E3%82%8B%E3%81%93%E3%81%A8&amp;diff=118"/>
		<updated>2019-07-17T23:58:30Z</updated>

		<summary type="html">&lt;p&gt;371: /* schema */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== dump/restore ==&lt;br /&gt;
=== dump ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_dump -Fc &amp;lt;DATABASE_NAME&amp;gt; &amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== restore ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
$ psql &amp;lt;DATABASE_NAME&amp;gt; &amp;lt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or pg_dumpでFcやFtをつけてたらこっち&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
$ pg_restore -d &amp;lt;DATABASE_NAME&amp;gt; &amp;lt;FILE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== role ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \du&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE ROLE &amp;lt;ROLE_NAME&amp;gt; WITH LOGIN PASSWORD &#039;&amp;lt;PASSWORD&amp;gt;&#039;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER ROLE &amp;lt;OLD_ROLE_NAME&amp;gt; TO &amp;lt;NEW_ROLE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP ROLE &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== database ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \l&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 切り替え ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \c &amp;lt;DABASE_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE DATABASE &amp;lt;DABASE_NAME&amp;gt; OWNER &amp;lt;ROLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP DATABASE &amp;lt;DATABASE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== table ==&lt;br /&gt;
=== 一覧（viewとかも） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \d&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 一覧（tableだけ） ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE TABLE IF NOT EXISTS &amp;lt;TABLE_NAME&amp;gt;(&lt;br /&gt;
    id BIGSERIAL,&lt;br /&gt;
    &amp;lt;COLUMN_NAME&amp;gt; &amp;lt;TYPE&amp;gt;,&lt;br /&gt;
    ...,&lt;br /&gt;
    PRIMARY KEY (id)&lt;br /&gt;
);&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.id IS &#039;ID&#039;;&lt;br /&gt;
COMMENT ON COLUMN &amp;lt;TABLE_NAME&amp;gt;.&amp;lt;COLUMN_NAME&amp;gt;IS &#039;&amp;lt;COMMENT&amp;gt;&#039;;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP TABLE IF EXISTS &amp;lt;TABLE_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== schema ==&lt;br /&gt;
=== 一覧 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# \dn&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 確認 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SELECT current_schema;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 作成 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# CREATE SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 名前変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER SCHEMA &amp;lt;OLD_NAME&amp;gt; RENAME TO &amp;lt;NEW_NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== search_path変更 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# ALTER USER &amp;lt;ROLE_NAME&amp;gt; SET search_path TO &amp;lt;SCHEMA_NAME&amp;gt;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
=== 削除 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt;; &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
or スキーマ内のテーブルごと削除&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sql&amp;quot;&amp;gt;&lt;br /&gt;
# DROP SCHEMA &amp;lt;SCHEMA_NAME&amp;gt; CASCADE;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:PostgreSQL]]&lt;br /&gt;
[[Category:Database]]&lt;br /&gt;
[[Category:よくやること]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=117</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=117"/>
		<updated>2019-03-25T01:10:53Z</updated>

		<summary type="html">&lt;p&gt;371: /* まとめ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=116</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=116"/>
		<updated>2019-03-25T00:58:38Z</updated>

		<summary type="html">&lt;p&gt;371: /* grep関連 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias egrep=&#039;egrep --color=auto&#039;&lt;br /&gt;
alias fgrep=&#039;fgrep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=115</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=115"/>
		<updated>2019-03-23T00:34:23Z</updated>

		<summary type="html">&lt;p&gt;371: /* まとめ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=114</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=114"/>
		<updated>2019-03-23T00:34:11Z</updated>

		<summary type="html">&lt;p&gt;371: /* ls関連 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto --full-time&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=113</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=113"/>
		<updated>2019-03-18T23:07:47Z</updated>

		<summary type="html">&lt;p&gt;371: /* aliasを記載する場所 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=112</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=112"/>
		<updated>2019-03-18T23:07:15Z</updated>

		<summary type="html">&lt;p&gt;371: /* aliasを記載する場所 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
RedHat系&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
Debian / Ubuntu系&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=111</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=111"/>
		<updated>2019-03-18T23:05:42Z</updated>

		<summary type="html">&lt;p&gt;371: /* aliasを記載する場所 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bash.bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=110</id>
		<title>よく使うalias</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=%E3%82%88%E3%81%8F%E4%BD%BF%E3%81%86alias&amp;diff=110"/>
		<updated>2019-03-15T04:23:38Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== aliasを記載する場所 ===&lt;br /&gt;
~/.bash_profile&amp;lt;br /&amp;gt;&lt;br /&gt;
or&amp;lt;br /&amp;gt;&lt;br /&gt;
/etc/bashrc&lt;br /&gt;
&lt;br /&gt;
=== aliasを即反映 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ source ~/.bash_profile&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== alias集 ===&lt;br /&gt;
==== ls関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== grep関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== git関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== cd関連 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== まとめ ===&lt;br /&gt;
黙ってこれをコピペ&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias ll=&#039;ls -lhA --color=auto&#039;&lt;br /&gt;
alias grep=&#039;grep --color=auto&#039;&lt;br /&gt;
alias gl=&#039;git log --oneline --decorate=full --graph --branches --tags --remotes --date=iso --format=&amp;quot;%C(yellow)%H%C(reset) %C(magenta)[%ad]%C(reset) %C(cyan)@%an%C(reset) %C(auto)%d%C(reset) %s&amp;quot;&#039;&lt;br /&gt;
alias ..=&#039;cd ..&#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:よく使う]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
	<entry>
		<id>https://wiki.r371.com/index.php?title=Linux%E3%81%A7%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E5%9C%A7%E7%B8%AE%E3%81%A8%E8%A7%A3%E5%87%8D&amp;diff=109</id>
		<title>Linuxでファイルの圧縮と解凍</title>
		<link rel="alternate" type="text/html" href="https://wiki.r371.com/index.php?title=Linux%E3%81%A7%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AE%E5%9C%A7%E7%B8%AE%E3%81%A8%E8%A7%A3%E5%87%8D&amp;diff=109"/>
		<updated>2019-03-08T06:39:29Z</updated>

		<summary type="html">&lt;p&gt;371: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== .gz ===&lt;br /&gt;
==== 圧縮 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ gzip &amp;lt;NAME&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 解凍 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ gunzip &amp;lt;NAME&amp;gt;.gz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== .tar.gz ===&lt;br /&gt;
==== 圧縮 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ tar -zcvf &amp;lt;NAME&amp;gt;.tar.gz &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 解凍 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ tar -zxvf &amp;lt;NAME&amp;gt;.tar.gz&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== .tar.bz2 ===&lt;br /&gt;
==== 圧縮 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ tar -jcvf &amp;lt;NAME&amp;gt;.tar.bz2 &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 解凍 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ tar -jxvf &amp;lt;NAME&amp;gt;.tar.bz2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== .zip ===&lt;br /&gt;
==== 圧縮 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ zip -r &amp;lt;NAME&amp;gt;.zip &amp;lt;DIR&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
==== 解凍 ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ unzip &amp;lt;NAME&amp;gt;.zip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:圧縮]]&lt;br /&gt;
[[Category:解凍]]&lt;/div&gt;</summary>
		<author><name>371</name></author>
	</entry>
</feed>