DEV Community

Cover image for Could you please tell me what sequence of Git commands
could have resulted in this commit graph?
Real Time Academy
Real Time Academy

Posted on

Could you please tell me what sequence of Git commands could have resulted in this commit graph?

https://dev-to-uploads.s3.amazonaws.com/i/tg4fvhpb0ntzzsviynar.PNG

Top comments (2)

Collapse
 
scgrk profile image
Stephen Gerkin

Assuming just a single developer, it's probably something similar to...

git init
git add . && git commit -m 'first commit'

Make some changes

git add . && git commit -m 'second commit'

The next branch could be created here

git checkout -b feature

Some changes made and saved

git add . && git commit -m 'awesome feature'

And then checkout the master branch, make some changes and what not

git checkout master
...
git add file1 file2 etc
git commit -m 'third commit'

Then the feature branch merged

git merge feature

Make some changes, and commit forward.

Alternatively, instead of branching directly from the second commit, development could have continued on the master branch and second commit checked out to branch from

git checkout 9359569
git checkout -b feature
...etc

However, more likely than not, it's more than one developer. The project was synced at the second commit and another person checked out the code from there while development continued on the master branch. They created another branch for the feature, and submitted a pull request into the master branch. That pull was then merged into the master branch.

Collapse
 
sinewalker profile image
Mike Lockhart

It is pretty disappointing to see this request, since it's a fairly blatant ask for someone else to solve an exam (or job interview) question...