Git Workflow for Modifying and Committing Changes

1.git init is used to initialize the new git repository. 2.git add is used to stage a specific file so that it will be included in the next commit. 3.git commit -m "Added personal details" is used to save (commit) your staged changes into the Git repository with a message describing what you did. 4.git status shows you the current state of your working directory and staging area. 5.git log is way of looking back in time at all the commits made in your repository. It includes Commit ID (unique SHA hash) , Author info , Date and time , Commit message. 6.git remote add origin is used to connect your local Git repository to a remote repository. 7.git branch is all about creating, listing, and managing branchesin Git repository. 8.git branch -m main is used to rename the current branch to main. 9.git push -u origin main is used to push your local main branch to the remote repository for the first time, and set it as the default upstream branch. After updating or modifying a file in your Git repository, here’s the steps to follow to track and commit those changes: 10.Check the current status: Run git status to see the changes you made. It will show you which files have been modified or are untracked. 11.Stage the changes: Use git add to stage the modified files you want to commit. 12.Commit the changes: After staging, commit your changes with a meaningful message. 13.Push the changes to the remote repository: If you're working with a remote repository, push your changes.

Apr 23, 2025 - 18:26
 0
Git Workflow for Modifying and Committing Changes

1.git init is used to initialize the new git repository.

Image description

2.git add is used to stage a specific file so that it will be included in the next commit.

Image description

3.git commit -m "Added personal details" is used to save (commit) your staged changes into the Git repository with a message describing what you did.

Image description

4.git status shows you the current state of your working directory and staging area.

Image description

5.git log is way of looking back in time at all the commits made in your repository. It includes Commit ID (unique SHA hash) , Author info , Date and time , Commit message.

Image description

6.git remote add origin is used to connect your local Git repository to a remote repository.

Image description

7.git branch is all about creating, listing, and managing branchesin Git repository.

Image description

8.git branch -m main is used to rename the current branch to main.

Image description

9.git push -u origin main is used to push your local main branch to the remote repository for the first time, and set it as the default upstream branch.

Image description

After updating or modifying a file in your Git repository, here’s the steps to follow to track and commit those changes:

10.Check the current status: Run git status to see the changes you made. It will show you which files have been modified or are untracked.

Image description

11.Stage the changes: Use git add to stage the modified files you want to commit.

Image description

12.Commit the changes: After staging, commit your changes with a meaningful message.

Image description

13.Push the changes to the remote repository: If you're working with a remote repository, push your changes.

Image description