DEV Community

James Kabuga
James Kabuga

Posted on

Day 2 Of Documenting my Learning Journey

Today I did a couple of things

What I learnt

1.I learnt on how to undo mistakes on Github:

  • 1. Before staging
  • 2. After staging
  • 3. After committing.

2.The difference between git checkout , git revert and git reset
3.Did an assignment on the above and uploaded on Discord channel

Explanation on What I learnt

git checkout - The command discards unstaged files. If you edited a file but you hadn't tracked it the command discards the contents in that file.

git revert - The command unstages a staged file. If you had staged a file using git add this means git has already tracked it and what's remaining is to commit. Using this command git revert you will unstage but the changes still remain. To undo the changes you use the previous command git checkout.

git reset - Used after you had already committed. It undo's commits. 1st we run the command git log --oneline and copy the commit hash. Then write the command git reset "paste commit hash". This will create a new commit that will undo the previous one.

Challenges I faced

Today everything run smoothly as before i wrote any command I made sure i was in the main branch by running the command git checkout main.

Resources I used

I followed a public repository with assignments by Bonaventure Ogeto.

It is stared and forked in my GitHub profile.

What I'll be doing Tomorrow

GitHub issues and Project Boards.

Tomorrow is the last day of learning git and GitHub then I do a project on the above.

Top comments (0)