I am trying to practice contributing to other repositories on Github but I am getting an errors while I try merging 2 branches:
error: Your local changes to the following files would be overwritten by merge:
game.js
Please commit your changes or stash them before you merge.
Aborting
and here is the git status output:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: game.js
I tried git push as well but
$ git push
remote: Permission to udacity/asteroids.git denied to Oalbacha.
fatal: unable to access 'https://github.com/udacity/asteroids.git/': The requested URL returned error: 403
Can you please help? Let me know if you need any more information. Thank you!
Okay, this seems to have solved my problem
Omar F Albacha (master +) asteroids $ git branch -d coins
warning: deleting branch 'coins' that has been merged to
'refs/remotes/origin/coins', but not yet merged to HEAD.
Deleted branch coins (was 354dfdd).
Omar F Albacha (master +) asteroids $ git branch --no-merged
easy-mode
Omar F Albacha (master +) asteroids $ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: game.js
Omar F Albacha (master +) asteroids $ git commit
[master 2449dd1] test
1 file changed, 1 insertion(+), 1 deletion(-)
Omar F Albacha (master) asteroids $ git merge master coins
merge: coins - not something we can merge
Did you mean this?
origin/coins
Omar F Albacha (master) asteroids $ git checkout coins
Switched to a new branch 'coins'
Branch coins set up to track remote branch coins from origin.
Omar F Albacha (coins) asteroids $ git branch
* coins
easy-mode
master
Omar F Albacha (coins) asteroids $ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Omar F Albacha (master) asteroids $ git branch
coins
easy-mode
* master
Omar F Albacha (master) asteroids $ git merge master coins
Auto-merging game.js
Merge made by the 'recursive' strategy.
game.js | 161 +++++++++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 115 insertions(+), 46 deletions(-)
There was a guide on stack overflow about cleaning out outdated branches.