Consigne - Jeck0v/Guts GitHub Wiki

πŸ›  Plumbing Commands

git hash-object <file> βœ…

  • Creates a blob object from file content and writes its SHA-1 to stdout.
  • ❌ Reject directories or missing files.

git cat-file -t|-p <oid> βœ…

  • -t: Print object type.
  • -p: Pretty-print blob/tree/commit content.
  • ❌ Reject invalid OIDs or missing options.

git write-tree βœ…

  • Create a tree object from the staging area.
  • Writes SHA-1 of the tree to stdout.

git commit-tree <tree_sha> -m "msg" [-p <parent>] βœ…

  • Creates a commit object pointing to a tree (and parent commit if any) and writes its oid to stdout
  • Requires -m message.
  • ❌ No annotated tags.

πŸ§‘β€πŸ’» Porcelain Commands

git init [<dir>] βœ…

  • Initializes a Git repository in the given directory.
  • Create .git/objects, .git/refs/heads, HEAD, and minimal config

git add <file>… βœ…

  • Adds files to the staging area (not directories).
  • ❌ No -p, no wildcards.

git rm <file>… βœ…

  • Removes a file from working directory and index.

git commit -m "msg" βœ…

  • Runs write-tree, creates a commit with HEAD as parent.
  • ❌ No editor or message prompt.

git status βœ…

  • Shows staged and unstaged changes.

git checkout [-b] <branch|sha> βœ…

  • Switch to existing commit or branch.
  • -b <branch> creates a new branch.
  • Change HEAD, update working dir, check for conflicts

git reset [--soft|--mixed|--hard] <sha>

  • --soft: move HEAD
  • --mixed: + reset index
  • --hard: + reset working directory
  • ❌ No file-specific reset.

git log βœ…

  • Print commit history from HEAD (one-line summary ok).

git ls-files βœ…

  • List all files in the index.

git ls-tree <tree_sha> βœ…

  • List contents of a tree object.

git rev-parse <ref> βœ…

  • Convert ref/branch/HEAD into SHA-1.
  • ❌ No complex selectors

git show-ref βœ…

  • List all refs and their hashes.

🧠 Advanced Feature: Merge Support

git merge <branch|sha>

  • Perform 3-way merge and create a merge commit with 2 parents.
  • On conflict: insert <<<<<<<, =======, >>>>>>> markers into file(s).
  • ❌ No rebase, squash, or fast-forward-only merges.

πŸ“„ Gitignore βœ…

  • Handle .gitignore
  • Use simple glob-style matching (e.g., *.log, build/)
  • ❌ No negation or nested .gitignore files.

πŸ— Index Implementation

  • You are free to implement the index your way.
  • βœ… Bonus if it matches Git’s format closely.

❌ Out of Scope

  • git push and git update-index are NOT required.
  • No support for remotes, rebase, tags, or stashing.

βœ… Deliverables

  • A working implementation of the listed commands.
  • Tests and example usage for each.
  • Clean error handling for all unsupported cases.

⏱ Time Estimate

  • Total time: 6–9 days
  • Use AI if needed, but understand what you're coding.

⚠️ **GitHub.com Fallback** ⚠️