# I'm in git trouble - really need some help

**URL:** <https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428>\
**Category:** General\
**Created:** [August 9, 2022, 12:42am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428 "2022-08-09T00:42:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 12:42am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/1 "2022-08-09T00:42:07Z")

</div>

Last week I created a branch for a feature and merged it locally with master. I did have some issues but everything worked. I merged another branch with my final feature and merged locally to master again but I had some issues. I don’t even know where to begin. I need to know how to get my final version which is on my hamburger-menu branch into my master branch.

My repo is [Tarp Configurations](https://github.com/Kernix13/tarp-configurations). My commit from yesterday was from master before I created my new branch. I had some issues with files in the master branch, I had to fix them but could not switch back to my branch until I committed them - I also pushed them. Basically, I need the changes from my branch to merge into my master but I have a few commits in the way. I did a `git revert` for my last commit from master but I need to do that I think 3 or 4 more times.

Would someone please help me undo this?

---

<div class="post-metadata">

**Author:** ![colinthornton](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/colinthornton/32/62129_2.png) [@colinthornton](https://forum.freecodecamp.org/u/colinthornton)\
**Post date:** [August 9, 2022, 1:08am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/2 "2022-08-09T01:08:42Z")

</div>

It looks like you have the hamburger-menu branch pushed up to GitHub. Can you just make a Pull Request (hamburger-menu→master (edit: or maybe the other way around? I’m still not 100% sure on what your issue is)) and try to resolve conflicts there if any come up?

---

<div class="post-metadata">

**Author:** ![colinthornton](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/colinthornton/32/62129_2.png) [@colinthornton](https://forum.freecodecamp.org/u/colinthornton)\
**Post date:** [August 9, 2022, 1:17am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/3 "2022-08-09T01:17:31Z")

</div>

You want to get your local hamber-menu branch up to date with your local master? Is that right?

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 1:22am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/4 "2022-08-09T01:22:31Z")

</div>

I’m not sure if I’m competent enough to explain what is going on. I guess my branch got pushed after I merged it locally with Master. But I was getting errors - merge conflicts where you get the ====HEAD and \>\>\>\> things throughout the file. Here is one of the stupid things I did - I copied the 3 files that had problems while in my branch into a separate project folder. Then I used that code for the corresponding files in Master. But now Master is messed up - my menu changed, my hamburger button doesn’t work, …

Here is what I had in my console (sorry about the F-bombs in my commit messages):

```auto

$ git reflog

e40ac45 (HEAD -> master, origin/master) HEAD@{0}: revert: Revert "FUCK"

a52caa8 HEAD@{1}: checkout: moving from hamburger-menu to master

20ce407 (origin/hamburger-menu, hamburger-menu) HEAD@{2}: checkout: moving from master to hamburger-menu

a52caa8 HEAD@{3}: commit: FUCK

a1af2bd HEAD@{4}: checkout: moving from hamburger-menu to master

20ce407 (origin/hamburger-menu, hamburger-menu) HEAD@{5}: checkout: moving from master to hamburger-menu

a1af2bd HEAD@{6}: commit: Fucking local merge

fb522e7 HEAD@{7}: checkout: moving from hamburger-menu to master

20ce407 (origin/hamburger-menu, hamburger-menu) HEAD@{8}: checkout: moving from master to hamburger-menu

fb522e7 HEAD@{9}: commit (merge): Ready to push to Netlify

ef73039 HEAD@{10}: checkout: moving from hamburger-menu to master

20ce407 (origin/hamburger-menu, hamburger-menu) HEAD@{11}: commit: Finished hamburger menu

```

```auto
git log --oneline --graph --all

$ git log --oneline --graph --all
* e40ac45 (HEAD -> master, origin/master) Revert "FUCK"
* a52caa8 FUCK
* a1af2bd Fucking local merge
* fb522e7 Ready to push to Netlify
|\
| * 20ce407 (origin/hamburger-menu, hamburger-menu) Finished hamburger menu
* | ef73039 push before hamburger menu build
* e40ac45 (HEAD -> master, origin/master) Revert "FUCK"
* a52caa8 FUCK
* a1af2bd Fucking local merge
* fb522e7 Ready to push to Netlify
|\
| * 20ce407 (origin/hamburger-menu, hamburger-menu) Finished hamburger menu
* | ef73039 push before hamburger menu build

```

I tried `git pull` from master, I did a reset for my last commit. I don’t know what to do. Branch hamburger menu is what I want. How to I get that?

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 1:40am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/5 "2022-08-09T01:40:54Z")

</div>

No the reverse. My master was pushed yesterday before I created hamburger-icon. I finished that tonight and did `git checkout master` followed by `git merge hamburger-icon`. I would prefer that hamburger-icon branch was master but everything is messed up now. I had to do git add filename for a few files back in master after the merge. I got the merge conflict things …blah-blah-blah. I’m considering running `npx create-react-app tarp-project --use-npm` again but for a new project folder and then moving everything over somehow.

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 1:52am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/6 "2022-08-09T01:52:30Z")

</div>

Can I somehow clone my branch `hamburger-menu` into a new project folder on my laptop and treat that as my “master” branch in that new folder? Then push that to a new repo on GitHub?

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 2:36am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/8 "2022-08-09T02:36:32Z")

</div>

Yes!

I downloaded that branch, copied it into a new project folder, and am running npm install now but it’s taking FOREVER. Assuming it finishes soon, I’ll run `npm start` to make sure it’s where I left off, and then I’ll use that new project folder as my project. `create-react-app` runs quicker so I’m wondering what is causing the slow install.

… just finished…will give updates in a minute. BTW, is merging a branch locally a bad idea? If so, where are the docs for basic/beginner git commands?

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 3:02am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/10 "2022-08-09T03:02:18Z")

</div>

Hmm, that is hard to say. My finished version before working on the mobile menu was yesterday right before I created the hamburger-menu branch. I don’t know why merging that branch into master created issues, but I will never merge locally again. I ran npm start but I forgot I did not have my assets folder. Had to stop and restart. I messed up but I do not know what I did wrong - that is what really bothers me. It’s weird how my cloned branch moved into a new folder has a branch name of main. It’s late and I’m going for the brute approach - create a new repo, delete the old. Why does local merges create a problem? Or am I missing something?

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 3:05am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/11 "2022-08-09T03:05:05Z")

</div>

Bingo! It worked but it’s a hack solution that works for a self-taught newbie. I thank you and collin for chiming in. I would like to somehow figure out what I did wrong.

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 3:23am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/13 "2022-08-09T03:23:50Z")

</div>

Wait a minute. FYI, I’m beat and calling it a night. Why would I have to pull anything down if I am creating a new branch after pushing all changes up? Is there something “weird” with local merges that you need to do a git pull after creating the branch, even though the newly created local branch should be a copy of master? Argh! I should have this on Netlify and updating my portfolio, instead I emptied the fridge of cold beers and will pick up in the morning…

---

<div class="post-metadata">

**Author:** ![kernix](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kernix/32/223280_2.png) [@kernix](https://forum.freecodecamp.org/u/kernix)\
**Post date:** [August 9, 2022, 12:32pm UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/15 "2022-08-09T12:32:40Z")

</div>

Well, that is what I will do in the future but I still don’t understand why a local merge created issues.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [February 8, 2023, 12:32am UTC](https://forum.freecodecamp.org/t/im-in-git-trouble-really-need-some-help/540428/16 "2023-02-08T00:32:55Z")

</div>

Closed on February 8, 2023, 12:32am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
