0

I had a local git branch of my project called my_branch.

I pushed the branch on Gitlab, so its name on Gitlab was my_branch.

Then I renamed the local branch as my_branch_2 via Pycharm bottom-left-located wizard (branch name > rename ...), and I also renamed it on Gitlab, via browser UI.

Now, in Pycharm, every time I VCS > Git > Push..., Pycharm suggests me to push the code into a new branch called my_branch as default.

In few words, in the left frame of window "Push commits to my_project", I have

my_branch_2 -> origin: my_branch (new!)

but what I want is

my_branch_2 -> origin: my_branch_2

How can I fix things in order to get it?

torek
  • 448,244
  • 59
  • 642
  • 775
Tms91
  • 3,456
  • 6
  • 40
  • 74
  • You simply need to change your local branch's upstream pointer. Does this answer your question? [What does '--set-upstream' do?](https://stackoverflow.com/q/18031946/184546) – TTT Sep 13 '21 at 14:05
  • This link is probably a little better: [Make an existing Git branch track a remote branch?](https://stackoverflow.com/q/520650/184546) – TTT Sep 13 '21 at 14:11
  • Hi, thanks for the suggestions, however, those thread does not answer my question since the simplest solution I needed deals with pycharm and not with git commands via command line. – Tms91 Sep 15 '21 at 12:15
  • 1
    Just a thought...When I first started using Git, like you, I also preferred to only use my client GUI rather than the command line. But I later learned that there are many things you can only do from the command line, and the feedback you get from the command line is far superior than most GUIs. Once I got more comfortable with the command line my Git experience greatly increased, and now I find it one of the most enjoyable parts of day to day coding. If I could go back in time I would have recommended to myself to use the command line from the beginning. (And buy bitcoin.) – TTT Sep 15 '21 at 13:57
  • Thanks for sharing your experience :) I will try to run git from command line rather than from GUIs – Tms91 Sep 20 '21 at 14:38

1 Answers1

0

SOLVED

By accessing the Pycharm bottom-left-located wizard (branch name > rename ...) I renamed the remote branch my_branch as my_branch_2, and now in the window "Push commits to my_project" I get:

my_branch_2 -> origin: my_branch_2

In conclusion, there was no need to touch Gitlab nor to run commands via command line, it was sufficient to rename both the local and the remote branches from the Pycharm bottom-left-located wizard.

Tms91
  • 3,456
  • 6
  • 40
  • 74