Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8832303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:29:52+00:00 2026-06-14T08:29:52+00:00

Assuming the following Git history: Branch1 B—C——-F—G / \ \ Master A——-D—E——-H Doing a

  • 0

Assuming the following Git history:

Branch1     B---C-------F---G
           /     \           \
Master    A-------D---E-------H

Doing a git log master gives the log entries in following order A-B-C-D-E-F-G-H. – but I’m interested in history of master-only (i.e A-D-E-H)

How can I “get rid” of the unwanted log-entries from Branch1? I tried a lot of options for git log, but I cannot find anything appropriate…


This leads to a further thing I don’t understand in this context:

Looking at the log-history given by git log master it shows how my branch master evolved (A-B-C-D-E-F-G-H).

But doing a git checkout HEAD~1 (assuming master=HEAD) gives me E (Evolution HEAD~3:A – HEAD~2:D – HEAD~1:E – HEAD:H -> A-D-E-H)

This is what I don’t understand: the ancestor of H looking at git log is G, while the ancestor of H looking at git checkout is E.

I don’t understand this – What’s the ancestor of H: G or E?…


Conclusion: What I would like to have are git log entries from HEAD to HEAD~n only (for example above n = 1…3).
How can this be achieved? Is it possible at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:29:54+00:00Added an answer on June 14, 2026 at 8:29 am

    What you’re looking for is

    git log --first-parent
    

    Why that option is called --first-parent answers your question

    I don’t understand this – What’s the ancestor of H: G or E?

    The answer is: both. E is the first parent, but G is the second parent, because H is a merge commit. A merge commit is one that has more than one parent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The title doesn't describe this very well, but assuming the following simplified table in
Assuming the following table: USER COLOR ORDER ================== JOE RED 1 JOE BLUE 2
Assuming the following: public class Order { public virtual int OrderId {get;set} public virtual
Assuming the following project layout:- mainrepo_git |____ .git |____ .gitmodules |____ proj <------- directory
Assuming the following domain entity : public enum Role { User = 0, Moderator
Assuming the following hypothetical inheritance hierarchy: public interface IA { int ID { get;
assuming the following html (minus the comments and nbsp; etc that xQuery wont process
assuming I have the following array: views = [ { :user_id => 1, :viewed_at
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
Assuming A.sql contains the following code, then second Select query won’t be executed due

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.