![]() It shows when branches and other references were updated. While git log shows commit logs, git reflog (short for reference logs) shows the history of all Git actions I’ve taken. You can also reset to a specific SHA by running git reset Git Reflog , I’ll have added the test file and the unit file: Changes to be committed:Īt this point, before I commit, I run git reset HEAD unit-file.js to unstage the unit file: Changes to be committed: I could just say git add test-file.js, but if instead I run git add. Then I want to stage the test file but not the unit file. I make comments as I go through it so I can piece together how it works, and then I have the knowledge I need to fix the test file. When that happens, I need to know what’s happening in that unit to be able to fix the test. For example, sometimes changing my code causes an existing unit test to fail. You can learn more about the -hard and -soft flags in Catherine’s article, I Screwed Up Git How Do I Fix It?Īnother way I use git reset is to unstage a file. The -hard flag tells it to reset the branch no matter what, so it’s one that I use sparingly. After that’s done, to keep my local environment clean, I’ll use git reset origin/branch -hard to reset my local branch to the SHA that is on the server. To do this, I’ll sometimes pull down the branch and make changes to figure out what a good suggestion would be. If part of their branch is broken, help them out by suggesting a fix instead of just pointing out the issue. Imagine you’re reviewing a pull request for someone, and they’ll need to make some changes. The git reset command is another one that’s useful in many scenarios. Using git log -oneline combines these flags for a super-condensed, need-to-know version of the commit log: 7a2733b feat: add photo carousel ![]() The second is -abbrev-commit, which shows a shorthand version of the commit SHA: commit 7a2733b The first is -pretty=oneline, which condenses the commit logs into a single line and removes the author and date details: 7a2733be4e9cfd057cc34c55673a578a9a021863 feat: add photo carousel This flag is actually a combination of two others. To condense the information I get from the log, I add the -oneline flag. As you can see from the example and the list of things I use the command for, I usually don’t need to know who authored the commit or the date of the commit. The basic git log command includes a lot of details that I’m not always interested in.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |