Skip to content

[FOSS] TASK-02: Git Commit Amend (First Year Only)Β #44

@Suvanwita

Description

@Suvanwita

FOSS β€” Second Issue πŸš€

Git Commit Amend

Issue Type

FOSS · Beginner · Open for All 🌍

Contribution Rules βœ…

  • Work only on foss branch
  • Original content only (No AI usage, otherwise Straight PR Rejection)

Objective

To learn how git commit --amend can be used to change both commit content and commit message while keeping the commit count as one.


Steps To Solve

  1. Switch to foss branch
git checkout foss
  1. Inside the task-02 folder, create a folder named with your GitHub Username.

Inside your folder, create a file named amend.txt with the following content:

Git practice.
  1. First commit (initial message)
git add amend.txt
git commit -m "Initial commit"

πŸ“Έ Screenshot 1 required
Run:

git log --oneline

Take a screenshot showing the initial commit message.

  1. Modify file content

Update amend.txt to:

Git amend practice.
  1. Amend the commit with a new message
git add amend.txt
git commit --amend

Change the commit message to:

Updated amend.txt using commit amend

πŸ“Έ Screenshot 2 required:
Again run:

git log --oneline

Take a screenshot showing the updated commit message.


Mandatory PR Requirements

  • Exactly ONE commit in history
  • Two screenshots:
    • Before amend (old commit message)
    • After amend (new commit message)
  • Screenshots must clearly show git log --oneline

PR Submission Checklist βœ…

  • amend.txt exists
  • Only one commit present
  • Commit message changed using --amend
  • Two screenshots attached in PR description

Answer the Following in Your Own Language (PR Description)

  • Why does Git still show only one commit after using git commit --amend?
  • What is the risk of using git commit --amend after pushing the commit?

Pull Request Rejection Criteria ❌

  • Wrong branch
  • More than one commit
  • Missing any screenshot
  • Same commit message in both screenshots
  • Unauthorized changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Points: 20open-for-allAny one can work on it without getting assigned, every PR can merge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions