| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
3,298 バイト追加 、 2023年1月29日 (日) 02:56
*特定の時点
$ git reset --hard 昔のコミットのハッシュ値
<blockquote>
*リモートにpush済みの場合、再度pushするとエラーになる
<pre>
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
</pre>
*無理矢理pushするには、-f とする
<pre>
$ git push -f origin master
</pre>
</blockquote>
 
 
=====resetの後最新の状態に戻す=====
* master
</pre>
*リモートのブランチ一覧
<pre>
$ git branch -r
origin/HEAD -> origin/master
origin/fix_chart
origin/master
</pre>
 
===ブランチを作る (branch)===
----
</blockquote>
===作業途中のブランチを切り替える(stash)===
[https://qiita.com/chihiro/items/f373873d5c2dfbd03250 【git stash】コミットはせずに変更を退避したいとき]
「とあるブランチで作業中だけど、いますぐやりたいことができた。作業がすごく中途半端だからコミットはしたくない。」
というときに、stashが使えます。
stashを使用すると、コミットしていない変更を退避することができます。
stashで現在の変更を退避して、今すぐやりたい作業をして、退避させていた変更を戻して作業を再開することができます。
 
*未コミットの状態だと、checkoutでブランチを切り替えられない
*git stash を利用することで、作業状態を保存し、ブランチを切り替えられる
===コンフリクトを解消===
----
*以下のようなコンフリクトが発生した場合
<pre>
Auto-merging lib/photo_list_screen.dart
CONFLICT (content): Merge conflict in lib/photo_list_screen.dart
Automatic merge failed; fix conflicts and then commit the result.
</pre>
*「自動マージに失敗しました。コンフリクトを修正してから結果をコミットしてください。」
*git status で対象を確認
<pre>
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
 
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
:
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: lib/photo_list_screen.dart
both modified: pubspec.lock
</pre>
*==== より上の部分が、HEADが参照しているブランチの内容
*==== より下の部分が、変更内容
*どちらかを採用するなどした後、git add , git commit
<pre>
<<<<<<< HEAD
.collection('users/${user.uid}/photos')
.doc()
.set(data);
=======
.collection('users/${user.uid}/photos')
.doc()
.set(data);
 
HttpsCallable callable = FirebaseFunctions.instance.httpsCallable('ocr',
options: HttpsCallableOptions(timeout: const Duration(seconds:30)));
 
var res = await callable.call(
{'gsUrl':'gs://tenarai-online.appspot.com/users/${user.uid}/photos/$path'});
//gs://tenarai-online.appspot.com/users/m8dAoyu7s3UJUNQwI1F8E3NcMO72/photos/1628325188064403_IMG_20210807_173119.jpg
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('Response'),
content: Text(res.data.toString()),
);
},
);
>>>>>>> 090b91525ddb715a39803757bd7617eeb0e8029a
</pre>
 
==リリースのハンドリング==
===タグを打つ (tag)===
$ git pull origin master
==[[Tips]]==
===日本語ファイル名日本語ファイル名を表示させる(文字化け対応)===
*日本語ファイル名は "\nnn" にエスケープされてしまって読めない。以下の設定を追加することで日本語ファイル名が表示されるようになる。
$ git config --global core.quotepath false
===[[Git]]でやらかしたときに使えるコマンド===
*https://qiita.com/muran001/items/dea2bbbaea1260098051
 
==Workflow==
*拾いもの
 
[[File:Git workflow.jpeg]]

案内メニュー