Link to home
Start Free TrialLog in
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



Avatar of rindi
rindi
Flag of Switzerland image

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.
Avatar of chalie001
chalie001

ASKER

I what to overwrite local work
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.
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

$ 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
Avatar of noci
noci

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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


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.