Avatar of chalie001
chalie001
 asked on

issue doing pull in github

hi am geting this error

 git pull origin master
Username for 'https://github.com': username
Password for 'https://username@github.com':
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 24 (delta 11), reused 16 (delta 3), pack-reused 0
Unpacking objects: 100% (24/24), done.
From https://github.com/username/ReactProj
 * branch              master     -> FETCH_HEAD
   3f77fdf3..3edcabe1  master     -> origin/master
error: Your local changes to the following files would be overwritten by merge:
        package-lock.json
        package.json
        src/index.js
        yarn.lock
Please commit your changes or stash them before you merge.
Aborting



Linux* gitlabLinux DistributionsWeb Servers

Avatar of undefined
Last Comment
David Favor

8/22/2022 - Mon
rindi

This happens if you download to the same location as you have done previously and have already worked with. I would download to a new location.
chalie001

ASKER
I what to overwrite local work
rindi

Then just delete the the directory before downloading. Or I usually rename the directory just in case I need it again or want to compare something.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
David Favor

1) Either delete the directory + do a new clone.

2) Or, just do the following to refresh any new updates from repository to local git directory...

git pull

Open in new window

chalie001

ASKER
$ git pull
Username for 'https://github.com':user
Password for 'https://user@github.com':
You are not currently on a branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>


ASKER CERTIFIED SOLUTION
noci

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
chalie001

ASKER
am geting this error creating branch
git branch maint
fatal: Failed to resolve HEAD as a valid ref.

git checkout -b maint
fatal: You are on a branch yet to be born


⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
David Favor

You said, "I what to overwrite local work".

This is accomplished by...

1) First do a clone into a directory... only once, you never do 2x clones...

2) Then to overwrite local work, cd to the directory + do a git pull, which will pull down all changes to repository.

3) If what you're asking is how to overwrite any changes you've made, revering to original repository files, the easy + foolproof solution is to destroy the entire directory, then do a git clone again.

You can... attempt to overwrite selective files, except this process is complex + error prone.