85 lines
1.5 KiB
Markdown
85 lines
1.5 KiB
Markdown
|
|
# Resolve Merge Conflict di Server Production
|
||
|
|
|
||
|
|
## Langkah-langkah:
|
||
|
|
|
||
|
|
### 1. Cek Status Git
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
||
|
|
git status
|
||
|
|
```
|
||
|
|
|
||
|
|
### 2. Lihat File yang Conflict
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git diff
|
||
|
|
```
|
||
|
|
|
||
|
|
### 3. Resolve Conflict
|
||
|
|
|
||
|
|
**Opsi 1: Keep Local Changes (jika ada perubahan lokal yang penting)**
|
||
|
|
```bash
|
||
|
|
# Lihat file yang conflict
|
||
|
|
git status
|
||
|
|
|
||
|
|
# Untuk setiap file yang conflict, pilih salah satu:
|
||
|
|
# - Keep local: git checkout --ours <file>
|
||
|
|
# - Keep remote: git checkout --theirs <file>
|
||
|
|
# - Manual edit: edit file, lalu git add <file>
|
||
|
|
```
|
||
|
|
|
||
|
|
**Opsi 2: Discard Local Changes (Recommended - gunakan versi dari repo)**
|
||
|
|
```bash
|
||
|
|
# Reset semua perubahan lokal
|
||
|
|
git reset --hard HEAD
|
||
|
|
|
||
|
|
# Pull lagi
|
||
|
|
git pull origin main
|
||
|
|
```
|
||
|
|
|
||
|
|
**Opsi 3: Stash Local Changes (simpan perubahan lokal untuk nanti)**
|
||
|
|
```bash
|
||
|
|
# Stash perubahan lokal
|
||
|
|
git stash
|
||
|
|
|
||
|
|
# Pull update
|
||
|
|
git pull origin main
|
||
|
|
|
||
|
|
# Jika perlu, restore perubahan lokal
|
||
|
|
git stash pop
|
||
|
|
```
|
||
|
|
|
||
|
|
### 4. Setelah Resolve, Commit
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Jika ada file yang di-edit manual
|
||
|
|
git add .
|
||
|
|
git commit -m "Resolve merge conflict"
|
||
|
|
|
||
|
|
# Atau jika menggunakan reset/stash, langsung pull
|
||
|
|
git pull origin main
|
||
|
|
```
|
||
|
|
|
||
|
|
### 5. Verify
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git status
|
||
|
|
# Seharusnya: "Your branch is up to date with 'origin/main'"
|
||
|
|
```
|
||
|
|
|
||
|
|
## Quick Fix (Recommended)
|
||
|
|
|
||
|
|
Jika tidak ada perubahan lokal yang penting:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cd /www/wwwroot/retribusi.btekno.cloud/retribusi
|
||
|
|
git reset --hard HEAD
|
||
|
|
git pull origin main
|
||
|
|
```
|
||
|
|
|
||
|
|
Ini akan:
|
||
|
|
1. Discard semua perubahan lokal
|
||
|
|
2. Pull update terbaru dari repository
|
||
|
|
3. Pastikan server sama dengan repository
|
||
|
|
|