every time I change the branch git goes back to master

117 Views Asked by At

it is simple I just do the git checkout branch-name and after 3 seconds my current branch is master again. steps:

  1. git checkout branch-name
  2. wait 3 seconds
  3. git goes back to branch master

I used git config --list to see my credentials and it was correct, the main repo has in bitbucket.

1

There are 1 best solutions below

0
On

Obviously : some other process is doing something to your git repository.

If your repo is placed in a synced directory, for example (Onedrive, Google cloud, Dropbox ...), since all your git's state is stored in files, an automatic update of the .git/ folder could (if done in the wrong direction) move back info like the checked out branch, or the stored files ...

If your repo is placed in a shared folder, someone else running actions would also modify what you see.

If a cron job, or a hook triggers some action on your repo, it could switch your active branch back to master.

etc ...