Fixing Git:
So, recently I was facing some issues with
pushing my committed file to the git branch name Origin/rahi. The problem all
started by git not committing any changes to the branch and making clone branch
of same name, which I was able to delete easily by switching back and forth between
branches but switching back to ‘Origin/rahi’ was not working. In my further
analysis I found that the reason behind the issue was the complexity of the
local folder. So, I reinstate the git and local folder, then I clone the
repository first. Later I tried to check the status, I got all the result
globally, which was strange because I didn’t have git installed globally. Still
I tried to commit checking that is it working if I commit any one file from
local folder or not.
I found
the git could not find the file since again the git was installed locally point
globally and was excluding the local folder, Since it consider that to be it’s
base for operating globally. I thought let me fix the issue by Deleting the git
and setting the git again as same as one I did when I initially made the
folder. But that didn’t worked either.
Now
since I had completed the work I wanted to share it as soon as possible I
committed the file manually to the git lab and try fixing it later. So, after
committing to the git I opened git again and found the it’s Head is pointing
towards the master branch the way I was expecting it and there was nothing in
the queue which made me think that the files are going towards master instead
of branch ‘Origin/rahi’. But when I checked the master branch or even any recent
activities there is nothing committed to any branch at all, which was not
making any sense, Since the commit where going somewhere. I tried goggling the
issue related to the git but found nothing.
Later I
asked Sadik, about it according to him I was missing to add ignore file for
global issue and he told me the fetch it and check the list of branch from git,
in which I got ‘nothing’. So, he explains me that I am either have not set the
folder towards the repository or there is some unknown issue. I made some
further try in switching the branch, pushing or committing to a branch
‘Origin/rahi’ in which I was getting error ‘saying no such file exist’ which I
googled about and got that instead of pushing I can make the HEAD the
difference towards a branch using ‘HEAD diff’. But since doing that I was
committing the changes somewhere unknown(not even master branch), which I had
no option but to google about the branch name, in which I found a real good
explanation regarding the big picture of the HEAD pointing where, so according
to the following link: https://stackoverflow.com/questions/5772192/how-can-i-reconcile-detached-head-with-master-origin
The HEAD was not pointing to any branch but to
the commit itself (according to the branch name). So whenever I commit
something It goes back to the commit itself. Which makes sense about it going
somewhere but branch. So, I used the solution given in the link which stated,
that I need to fetch the git and create a new branch and make it point towards
master but since I wanted it to be point to ‘Origin/rahi’ I made the HEAD
pointing towards it. Now the current branch is ‘Origin/rahi’ and I can push
local folder to it. This issue was a roller coaster ride for me. Phew!! It is
gone!!
So, recently I was facing some issues with
pushing my committed file to the git branch name Origin/rahi. The problem all
started by git not committing any changes to the branch and making clone branch
of same name, which I was able to delete easily by switching back and forth between
branches but switching back to ‘Origin/rahi’ was not working. In my further
analysis I found that the reason behind the issue was the complexity of the
local folder. So, I reinstate the git and local folder, then I clone the
repository first. Later I tried to check the status, I got all the result
globally, which was strange because I didn’t have git installed globally. Still
I tried to commit checking that is it working if I commit any one file from
local folder or not.
I found
the git could not find the file since again the git was installed locally point
globally and was excluding the local folder, Since it consider that to be it’s
base for operating globally. I thought let me fix the issue by Deleting the git
and setting the git again as same as one I did when I initially made the
folder. But that didn’t worked either.
Now
since I had completed the work I wanted to share it as soon as possible I
committed the file manually to the git lab and try fixing it later. So, after
committing to the git I opened git again and found the it’s Head is pointing
towards the master branch the way I was expecting it and there was nothing in
the queue which made me think that the files are going towards master instead
of branch ‘Origin/rahi’. But when I checked the master branch or even any recent
activities there is nothing committed to any branch at all, which was not
making any sense, Since the commit where going somewhere. I tried goggling the
issue related to the git but found nothing.
Later I
asked Sadik, about it according to him I was missing to add ignore file for
global issue and he told me the fetch it and check the list of branch from git,
in which I got ‘nothing’. So, he explains me that I am either have not set the
folder towards the repository or there is some unknown issue. I made some
further try in switching the branch, pushing or committing to a branch
‘Origin/rahi’ in which I was getting error ‘saying no such file exist’ which I
googled about and got that instead of pushing I can make the HEAD the
difference towards a branch using ‘HEAD diff’. But since doing that I was
committing the changes somewhere unknown(not even master branch), which I had
no option but to google about the branch name, in which I found a real good
explanation regarding the big picture of the HEAD pointing where, so according
to the following link: https://stackoverflow.com/questions/5772192/how-can-i-reconcile-detached-head-with-master-origin
The HEAD was not pointing to any branch but to
the commit itself (according to the branch name). So whenever I commit
something It goes back to the commit itself. Which makes sense about it going
somewhere but branch. So, I used the solution given in the link which stated,
that I need to fetch the git and create a new branch and make it point towards
master but since I wanted it to be point to ‘Origin/rahi’ I made the HEAD
pointing towards it. Now the current branch is ‘Origin/rahi’ and I can push
local folder to it. This issue was a roller coaster ride for me. Phew!! It is
gone!!
Comments
Post a Comment