Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git says everything-up-to-date when pushing changes to a remote branch

i have commits that are in a remote repository (origin/master) which i want to put in a branch created from that repository (origin/remote_branch).

when i checkout to that remote branch

git checkout -b mybranch origin/remote_branch

then cherry-picked the commits that i made

git cherry-pick 9df63616b0428cf6edc4261adb533a1ac516b9a0

git says everything-up-to-date when i try to push.

git push

is there anything i'm doing wrong?

like image 459
paolo granada lim Avatar asked Sep 08 '09 02:09

paolo granada lim


People also ask

Why is git push showing everything up to date?

If you do not give a branch name as an argument to the git push command, the main branch is selected by default. If the branch you want to push changes to is different, specify it. Otherwise, you may get an error. This problem may also occur if the local branch name is different from the remote branch name.

Why does git say already up to date?

If the current branch is not outdated compared to the one you pull from, pull will say Already up-to-date. even if you have local changes in your working directory. git pull is concerned with branches, not the working tree — it will comment on the working tree only if there are changes which interfere with the merge.

Why does git say my branch is up to date when it isn t?

On branch master, Your branch is up to date with 'origin/master. As long as you haven't made any new commits that message is correct, unversioned/changed files that haven't been committed yet should be listed below it. If unversioned files don't show up, check if they might be hidden by a . gitignore file.

What does everything up to date mean?

1 : extending up to the present time : including the latest information up-to-date maps. 2 : abreast of the times : modern up-to-date methods.


1 Answers

Depending on your version of Git, it may be trying to push branches with matching names, i.e., master to origin/master and remote_branch to origin/remote_branch. If your origin repository doesn't have a branch named mybranch then it thinks there's nothing to update.

To override this default, you can explicitly tell git which branch to use as the source (mybranch) and which to use as the destination on the remote repository (remote_branch):

git push origin mybranch:remote_branch

There's a config option to tell git to push to remote tracking branches by default:

git config --global push.default tracking

I find this more intuitive and I think it's the behavior you're looking for. Checkout the push.default option in the git config man page. Also checkout the Examples section in the git push man page to see how to override the default behavior.

like image 165
Pat Notz Avatar answered Oct 21 '22 16:10

Pat Notz