SuperAPI AI Directory

git-teacher-upload

General & other

View repository

Updated 10-15 21:42

About this skill

Upload — Phase 4 (Barda Git Teacher)

Pushes the committed content to the GitHub cloud. On success, provides the GitHub URL.

Execution order

Step 1: Collect status in parallel

Run the following commands in parallel :

git rev-parse --is-inside-work-tree    # .git 존재 확인
git symbolic-ref --short HEAD          # 현재 branch
git status --porcelain                 # 미저장 변경 확인
git rev-list --count @{u}..HEAD 2>/dev/null || echo "no-upstream"  # 올리지 않은 commit 수
git remote get-url origin 2>/dev/null  # 원격 저장소 URL

Step 2: Safety check

  1. .git none: "This isn't a Git project folder." → abort
  2. Detached HEAD: retry after automatic recovery
  3. No remote repository: "You're not connected to GitHub. Please set it up first with 'start Git'." → abort
  4. Uncommitted changes present: "There are changes that haven't been committed yet. Please commit them first with 'commit it'." → abort
  5. Nothing to upload (HEAD and upstream are the same): "Everything is already uploaded to GitHub." → abort

Step 3: Execute push

git push origin HEAD

Step 4: Print receipt

On success

Construct and provide the GitHub URL:

업로드 완료!

GitHub에서 확인: https://github.com/username/my-project
저장한 내용 2개가 클라우드에 올라갔어요.

이제 다른 사람도 이 내용을 볼 수 있어요.

GitHub URL은 git remote get-url origin Extract it from the result. If it's an SSH URL, convert it to an HTTPS URL:

  • git@github.com:user/repo.git → https://github.com/user/repo

On failure

업로드에 실패했어요.

Guidance for common failure causes:

  • rejected (non-fast-forward): "Someone else has uploaded content first. I'll fetch the latest content first." → detect the current branch name and git pull --rebase origin {현재 branch} attempt to run automatically. On success, push again.
  • permission denied: "You don't have GitHub access permission. Try logging in again with 'start Git'."
  • remote not found: "The GitHub connection was lost. Please set it up again with 'start Git'."

When a conflict occurs after pull

git pull --rebase If a conflict occurs after EXECUTE: , immediately call the AskUserQuestion tool with the JSON below:

{
  "questions": [{
    "question": "클라우드의 최신 내용을 받아오다가 충돌이 생겼어요. 두 사람이 같은 부분을 동시에 고쳤거든요.\n충돌 파일: {파일 목록}\n\n어떻게 할까요?",
    "header": "충돌 해결",
    "options": [
      {"label": "내가 수정한 걸로 유지", "description": "내 변경 내용을 사용해요"},
      {"label": "상대방이 수정한 걸로 유지", "description": "상대방의 변경 내용을 사용해요"}
    ],
    "multiSelect": false
  }]
}

Depending on the choice:

  • "Keep mine": git checkout --ours {파일} → git add {파일} → git rebase --continue
  • "Keep theirs": git checkout --theirs {파일} → git add {파일} → git rebase --continue

After resolving the conflict, automatically retry the push.

Guidance for next actions

  • On success: "To ask a teammate for a review, say 'request a review'."
  • On failure: present solutions by cause