Git challenges

Practice problem statements with input format, output format, constraints and solutions.

beginner

Git Introduction challenge

Build a small solution that uses Git Introduction in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/git-introduction
git add src/app
git commit -m "Practice git-introduction"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core git introduction pattern before polishing the final output.

Solution

git status
git switch -c feature/git-introduction-solution
git add src/app
git commit -m "Practice git-introduction-solution"
git log --oneline -3
beginner

Install Git challenge

Build a small solution that uses Install Git in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/install-git
git add src/app
git commit -m "Practice install-git"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core install git pattern before polishing the final output.

Solution

git status
git switch -c feature/install-git-solution
git add src/app
git commit -m "Practice install-git-solution"
git log --oneline -3
beginner

git init challenge

Build a small solution that uses git init in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/git-init
git add src/app
git commit -m "Practice git-init"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core git init pattern before polishing the final output.

Solution

git status
git switch -c feature/git-init-solution
git add src/app
git commit -m "Practice git-init-solution"
git log --oneline -3
beginner

git add challenge

Build a small solution that uses git add in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/git-add
git add src/app
git commit -m "Practice git-add"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core git add pattern before polishing the final output.

Solution

git status
git switch -c feature/git-add-solution
git add src/app
git commit -m "Practice git-add-solution"
git log --oneline -3
beginner

git commit challenge

Build a small solution that uses git commit in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/git-commit
git add src/app
git commit -m "Practice git-commit"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core git commit pattern before polishing the final output.

Solution

git status
git switch -c feature/git-commit-solution
git add src/app
git commit -m "Practice git-commit-solution"
git log --oneline -3
beginner

git status challenge

Build a small solution that uses git status in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/git-status
git add src/app
git commit -m "Practice git-status"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core git status pattern before polishing the final output.

Solution

git status
git switch -c feature/git-status-solution
git add src/app
git commit -m "Practice git-status-solution"
git log --oneline -3
beginner

Branch challenge

Build a small solution that uses Branch in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/branch
git add src/app
git commit -m "Practice branch"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core branch pattern before polishing the final output.

Solution

git status
git switch -c feature/branch-solution
git add src/app
git commit -m "Practice branch-solution"
git log --oneline -3
beginner

Checkout challenge

Build a small solution that uses Checkout in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/checkout
git add src/app
git commit -m "Practice checkout"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core checkout pattern before polishing the final output.

Solution

git status
git switch -c feature/checkout-solution
git add src/app
git commit -m "Practice checkout-solution"
git log --oneline -3
beginner

Merge challenge

Build a small solution that uses Merge in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/merge
git add src/app
git commit -m "Practice merge"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core merge pattern before polishing the final output.

Solution

git status
git switch -c feature/merge-solution
git add src/app
git commit -m "Practice merge-solution"
git log --oneline -3
beginner

Remote challenge

Build a small solution that uses Remote in Git and handles one normal case plus one edge case.

Input format

Use a short text value, array, query, or sample object depending on the topic.

Output format

Print, render, or return the processed result in a readable format.

Constraints

  • Keep the solution under 60 lines.
  • Use descriptive names.
  • Do not depend on hidden external services.

Starter code

git status
git switch -c feature/remote
git add src/app
git commit -m "Practice remote"
git log --oneline -3

Test cases

  • basic sample - valid processed result
  • empty or small sample - safe fallback result

Hint

Focus on the core remote pattern before polishing the final output.

Solution

git status
git switch -c feature/remote-solution
git add src/app
git commit -m "Practice remote-solution"
git log --oneline -3