DEV Community

Cover image for Hacktoberfest 2021! My second contribution
MizuhoOkimoto
MizuhoOkimoto

Posted on • Updated on

Hacktoberfest 2021! My second contribution

On the second week of October, I made another Pull Request(PR). I will introduce the project and also my big mistake (how to rebase push and merge)😂

Project

This project was a meditation app created on React.JS and bootstrapped with Create React App.
Project Repo: https://github.com/akshat157/meditate-app

Issue

The issue was changing the fonts, one of the owners of the repository said that the current font looks outdated.
Issue: https://github.com/akshat157/meditate-app/issues/32

What I did

I opened the Google Fonts and looked at the many fonts. I wasn't very confident because I hadn't studied the design side, but I chose Barlow and Maven Pro fonts because they are easy to read and they don't look like the default fonts.
App interface

Pull Request

I was going to make a PR... BUT...!

I had a problem 😨😨😨

The CONTRIBUTE.md says not to push to main branch but I did it...
I was going to delete my forked repo and the branch and make everything restart. However, I chose to contact to
Professorrrrrrrr😭 for a better understanding. He helped me right away and told me how to do it.

How did I solve it?

First of all, he suggested I do the below commands:

$git checkout -B issue-32 c9dbd88
$git checkout main
$git pull upstream main
$git checkout issue-32
$git rebase main
Enter fullscreen mode Exit fullscreen mode

However, my push and merge were still there like below:

PS C:\Users\Mizuho\meditate-app> git checkout -B issue-32 c9dbd88
Switched to and reset branch 'issue-32'
PS C:\Users\Mizuho\meditate-app> git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.
PS C:\Users\Mizuho\meditate-app> git pull upstream main
From https://github.com/akshat157/meditate-app
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> upstream/main
warning: refname 'd327d53e852a17353ecb297da2f819ac7bceee0f' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,
  git switch -c $br $(git rev-parse ...)
 where "$br" is somehow empty and a 40-hex ref is created. Please
 examine these refs and maybe delete them. Turn this message off by
 running "git config advice.objectNameWarning false"
Already up to date.
PS C:\Users\Mizuho\meditate-app> git checkout issue-32
Switched to branch 'issue-32'
PS C:\Users\Mizuho\meditate-app> git rebase main
First, rewinding head to replay your work on top of it...
Fast-forwarded issue-32 to main.
PS C:\Users\Mizuho\meditate-app> git status
On branch issue-32
nothing to commit, working tree clean
PS C:\Users\Mizuho\meditate-app> git log
Merge: d327d53 c9dbd88
Author: MizuhoOkimoto <54873998+MizuhoOkimoto@users.noreply.github.com>
    Merge branch 'issue-32' into main
commit c9dbd884650c1a1abb324822d8d08e1fd7521eae
Author: MizuhoOkimoto <54873998+MizuhoOkimoto@users.noreply.github.com>
Date:   Fri Oct 15 18:14:45 2021 -0400
    Add font family Barlow and Maven Pro
Enter fullscreen mode Exit fullscreen mode

He pointed out that I didn't make a remote(!). I just created a branch. I made a new branch and used pull command to fetch and merge to the 'dev' branch, and rebased it.

PS C:\Users\Mizuho\meditate-app> git checkout dev
Switched to branch 'dev'
Your branch is up to date with 'origin/dev'.
PS C:\Users\Mizuho\meditate-app> git pull upstream dev
From https://github.com/akshat157/meditate-app
 * branch            dev        -> FETCH_HEAD
 * [new branch]      dev        -> upstream/dev
Already up to date.
PS C:\Users\Mizuho\meditate-app> git checkout issue-32
Switched to branch 'issue-32'
PS C:\Users\Mizuho\meditate-app> git rebase dev
Current branch issue-32 is up to date.
PS C:\Users\Mizuho\meditate-app> git push origin issue-32
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'issue-32' on GitHub by visiting:
remote:      https://github.com/MizuhoOkimoto/meditate-app/pull/new/issue-32
remote:
To https://github.com/MizuhoOkimoto/meditate-app.git
Enter fullscreen mode Exit fullscreen mode

I switched to main($git checkout main) and did $git log, but main was still head to my push. He told me to do that with the capital -B command:

PS C:\Users\Mizuho\meditate-app> git checkout -B main upstream/main
Reset branch 'main'
warning: refname 'd327d53e852a17353ecb297da2f819ac7bceee0f' is ambiguous.
Git normally never creates a ref that ends with 40 hex characters
because it will be ignored when you just specify 40-hex. These refs
may be created by mistake. For example,
  git switch -c $br $(git rev-parse ...)
where "$br" is somehow empty and a 40-hex ref is created. Please
examine these refs and maybe delete them. Turn this message off by
running "git config advice.objectNameWarning false"
Branch 'main' set up to track remote branch 'main' from 'upstream'.
Your branch is behind 'origin/main' by 3 commits, and can be fast-forwarded.
Enter fullscreen mode Exit fullscreen mode

$git log on main branch...

My push and merge on the main branch was gone!😇
I could finally made a PR.
PR: https://github.com/akshat157/meditate-app/pull/35

Conclusion

I wasn't careful with this PR and I made a mistake. Even though I learned about amend and rebase that week when it happened. However, I panicked and couldn't solve it by myself. Next time, I definitely will read the contribution section more carefully!

Happy Hacktoberfest!🎃

(Photo by David Libeert on Unsplash)

Oldest comments (2)

Collapse
 
rohithv07 profile image
Rohith V

Wow, great for making the pull request and also you learned some new concept like creating new branch, checking out. Kudos

Collapse
 
okimotomizuho profile image
MizuhoOkimoto

Thank you, Rohith! Luckily, I'm learning many things from my open source course :D