From 7a281fb57b1f60c9e7d259d5646a6e5166c8ed97 Mon Sep 17 00:00:00 2001 From: mpabi Date: Sun, 26 Apr 2026 09:39:02 +0200 Subject: [PATCH] Prefer remote add workflow in README --- README.md | 63 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 08c74c3..f0b9b23 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ To repo zawiera launcher do workspace `rv`: - `workspace.py tmux-container ...` stawia sesje `tmux` z kontenerem w `pane 0` - `doc/usage.md` opisuje przelaczniki CLI i format listowania -## Pobranie repo +## Przygotowanie katalogu Docelowy katalog: @@ -15,13 +15,13 @@ Docelowy katalog: ~/dev/workspace/rv/tools/rv-launcher ``` -Bootstrap: +Bootstrap bez `git clone`: ```bash mkdir -p ~/dev/workspace/rv/tools -cd ~/dev/workspace/rv/tools -git clone http://77.90.8.171:3001/edu-tools/rv-launcher.git -cd rv-launcher +mkdir -p ~/dev/workspace/rv/tools/rv-launcher +cd ~/dev/workspace/rv/tools/rv-launcher +git init ``` ## Autoryzacja @@ -38,15 +38,15 @@ Przyklad: ```bash git remote add r1 http://u1:TOKEN@77.90.8.171:3001/edu-tools/rv-launcher.git git fetch r1 main -git switch main -git pull --ff-only r1 main +git switch --track -c main r1/main ``` Jesli po zajeciach uzytkownik bedzie chcial wyslac projekt na swoje konto -Gitea, moze zmienic URL remota `r1` na swoje repo: +Gitea, lepiej dodac osobny remote `r2`, zamiast przepinac `r1`: ```bash -git remote set-url r1 http://LOGIN:TOKEN@77.90.8.171:3001/LOGIN/rv-launcher.git +git remote add r2 http://LOGIN:TOKEN@77.90.8.171:3001/LOGIN/rv-launcher.git +git push -u r2 main ``` ### Droga 2: lokalny `tokens/gitea_tokens.json` @@ -85,38 +85,57 @@ chmod 700 ~/dev/workspace/rv/tokens chmod 600 ~/dev/workspace/rv/tokens/gitea_tokens.json ``` +Jesli token jest trzymany tylko w `tokens/gitea_tokens.json`, remote `r1` moze +byc zapisany bez sekretu: + +```bash +git remote add r1 http://77.90.8.171:3001/edu-tools/rv-launcher.git +``` + ## Fetch i switch Domyslna galaz launchera to `main`. -Po sklonowaniu: +Wariant preferowany przez `r1`: + +```bash +git fetch r1 main +git switch --track -c main r1/main +git pull --ff-only r1 main +``` + +Jesli repo bylo sklonowane klasycznie i pracujesz przez `origin`, odpowiednikiem +jest: ```bash git fetch origin main git switch main -git pull --ff-only -``` - -Jesli pracujesz przez `r1`, odpowiednikiem jest: - -```bash -git fetch r1 main -git switch main -git pull --ff-only r1 main +git pull --ff-only origin main ``` Jesli chcesz wejsc na inna galaz, na przyklad `feat/x`, uzyj: +```bash +git fetch r1 feat/x +git switch --track -c feat/x r1/feat/x +``` + +Wariant przez `origin`: + ```bash git fetch origin feat/x git switch --track -c feat/x origin/feat/x ``` -Wariant przez `r1`: +## Wariant alternatywny: `git clone` + +Jesli celem nie jest cwiczenie `remote add` i `fetch`, mozna tez uzyc: ```bash -git fetch r1 feat/x -git switch --track -c feat/x r1/feat/x +mkdir -p ~/dev/workspace/rv/tools +cd ~/dev/workspace/rv/tools +git clone http://77.90.8.171:3001/edu-tools/rv-launcher.git +cd rv-launcher ``` ## Podstawowe komendy