made
git branch local_branch_name origin/branch_name after the change I am writing
git push origin/local_branch_name mistake
where is the mistake? How can you solve?
made
git branch local_branch_name origin/branch_name after the change I am writing
git push origin/local_branch_name mistake
where is the mistake? How can you solve?
Trouble
git branch does not switch the active branch!You made a branch, but did not switch to it, and you did not commit it.
In the "daily git-usage" you will almost never use the git branch directly, rather you will use checkout with the -b option (from b ranch):
git checkout -b новая-ветка ... that will do the branch where you ( HEAD ) are now , and also switch to it. If you want a branch in some other place, then specify it:
git checkout -b новая-ветка место-новой-ветки origin/* )!The only thing for which they are needed is to indicate to you where the server branches are located. Even when interacting with the server, you will not specify these branches, since they do not exist for the server. And commit in them is not accepted. The general view of git-push is:
git push <сервер> <откуда-локально>:<куда-на-сервере> Plus abbreviated forms:
git push <сервер> <откуда-локально> # зальётся в ветку "за которой следит" git push # как выше, но текущая ветка I suppose events developed as follows:
git checkout origin/DIMA # это уже крайне подозрительное действие git branch DIMA origin/DIMA # создали ветку, но не переключились git commit ... # что-то закоммитили: ой, вы же были в detached HEAD вне веток! git commit ... # ещё что-то закоммитили! ... and if I’m about right, then the problem will be solved simply by the "loss-of-commits" ( English dangling commits ) to the branch where they were originally intended; if the branch is now exactly behind them (and has not gone forward since then), then fast-forward will occur. Therefore, we will add the --ff-only flag to the --ff-only so that if I am wrong (and you broke the repository more than I thought), the merge did not happen.
First, we fix the "losers", denoting a stable place in history for them.
"In any strange situation, make a branch"
git checkout -b marker Now you have to go where these commits were meant.
git checkout DIMA And now let's try to rewind DIMA forward, including the former "losers":
git merge --ff-only marker ... and if merge occurred, it seems that I guessed your script, and it looks like, with my manipulations (after the first command => after the third), something like this:
And now, in theory, you can do just git push (without all) and the branch will go to the server.
These are commits that cannot be reached from the "fixed points" by following the "back" (following the links to the parent commits). Such "fixed points" are branches (branch) and tags (tag).
All commits that Git cannot reach from such points are garbage and should be deleted sometime , they cannot be guaranteed to be safe, they can be eaten at any moment by git gc . From here and the "losses", for the history these commits are lost, if someone (for example, git reflog ) did not record their hash.
Such commits are caused by, for example, git commit --amend , or any meaningful (not fast-forward) git rebase .
Source: https://ru.stackoverflow.com/questions/505069/
All Articles
git branch local_branch_name origin/branch_namenot a good option for work? It turns out you just need to clone yourself in master and push as origin, right? - bemulimagit branch local_branch_name origin/branch_nameis to create a branch based on another one, but go to it !!!! need to explicitly go through checkout. - KoVadimpush, nothing? - bemulima