View Unique Commits Branch vs Origin
EPAM 👶 Easy Git
Beginner Mode

Start your terminal to use beginner mode.

Scenario

A Git repository at /home/interview/repo has a feature-api branch that was created from origin/main some time ago. The branch has your commits plus merge commits from pulling updates, making it difficult to identify which commits are unique to your branch.

Task

Find commits unique to your branch compared to origin/main, exclude merge commits, write the unique commits to /home/interview/unique-commits.txt, and verify the file contains only the unique commits.

Note: The remote repository origin is already configured.

Example

# Before (file does not exist)

ls: cannot access '/home/interview/unique-commits.txt': No such file or directory
# After (unique commits saved to file)

File created with unique commits from feature-api branch
Merge commits excluded
Only commits not present in origin/main are listed

Example '/home/interview/unique-commits.txt' content:
"""
ree2ras Commit message
cji29nc Commit message
ch92uhd Commit message 
"""

Terminal requires a larger screen

Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.

Linux Terminal Environment

Write and execute your solution in the terminal below.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →