dcparham
dcparham

Reputation: 291

trying to push file into bitbucket repo, but showing wrong repo

Normally I open a bash prompt inside my Test folder. I then git add, commit, and push origin the file and it goes into my Test folder in bitbucket. Now somehow my Test folder instead of showing .../Test (Development), it shows another repo, .../Test (Review). I do not know why it changed. How can I get (Review) to be (Development)?

Upvotes: 0

Views: 129

Answers (1)

AK_is_curious
AK_is_curious

Reputation: 239

In git there are pretty much three stages. When pressing git status you probably get a similar few to this with many more files:

# On branch review
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   file.txt
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   file2.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   file3.txt

file.txt on top has staged changes. These will go into the next commit when you do git commit.

file2.txt has unstaged changes. This file is tracked in the repository but the changes will not be added to the next commit. Only if you git add this file will it get staged.

file3.txt is an untracked file. You have to add it with git add which will automatically put it into the staged area. Next time you will make changes to it you will find it in the unstaged area like file2.txt

from this situation git checkout master gives:

error: Your local changes to the following files would be overwritten by checkout:
    file2.txt
Please, commit your changes or stash them before you can switch branches.
Aborting

This is probably what you get too. Git noticed that you made changes in the tracked file file2.txt but you didn't specify what to do with them. Similarly I suspect that you made changed to those '50 or so files' and now git doesn't know what to do.

Either add them to your commit and do a commit:

git add <files>
git commit -m "did some work"

or drop the changes:

git checkout <files>

Then they will return to the way they were at the last commit.

You can also add some files and drop others, or even do partial adds with git add -p.

Check the changes you made with git diff.


After this is resolved you can switch branches again with git checkout <branchname>.

Without more information on your branch structure in your bitbucket and your commit history it is hard to say what you can push to where.

Upvotes: 1

Related Questions