Reputation: 931
I started working on a coding challenge for a job interview. I wasn't thinking too hard and created a GitHub repo so I could switch between laptop and desktop. I committed to the remote and started working. Then I even approved a pull request when I was done with the initial stuff.
My local history now looks like this:
692f26c (HEAD -> main) Edit readme
baa065e (origin/main, origin/HEAD) Merge pull request #1 from philosofool/first_steps
4334871 (origin/first_steps) Add Slow, Working Agents
6476f68 WIP
7e4bdf1 WIP noteboook update
fd86b35 Initial Readme
b712214 Initial commit
The problem: I literally got an email from the hiring supervisor saying that a GitRepo would be the best way to submit the work because it showcases how I write commit messages.
"WIP moving to my other computer" isn't exactly what people looking at the remote need to know, right?
I know it's bad practice to edit history, but in this case, no one else is working with the repo and I need it to look good.
The urgent question is "Can I remove the two WIP message, and how?" and the second one is how to avoid this in the future while still using GitHub in this way. (It's awfully convenient for working on two computers.)
Upvotes: 2
Views: 285
Reputation: 207
I think you are overthinking it. You are showing by using git and the comments that you understand how it works, and while not best practice you are using more advanced features than a lot of candidates.
However, you can use git commit --amend
If you have already pushed the commit to GitHub, you will have to force push a commit with an amended message. Further instructions can be found here.
https://docs.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message
Upvotes: 2