1

I have one git repository and now I have to switch the repo code to deploy to other repository and to change the remote URL I have used below command.

git remote set-url origin new.git.url/here

Now I can see the remote URL is got changed. But when I do

git branch

it still shows me the same number of branches and the same code. But the repo is totally new it has only one master branch.

So my question is can I refresh the folder/git repository?

Hasitha Jayawardana
  • 2,326
  • 4
  • 18
  • 36
Profer
  • 553
  • 8
  • 40
  • 81
  • 1
    Possible duplicate of [How to prune local tracking branches that do not exist on remote anymore](https://stackoverflow.com/questions/13064613/how-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore) – joran Jul 10 '19 at 14:39

2 Answers2

1

With git remote prune origin you can remove the local branches that are not on the remote any more.

For more information have a look at this SO question: Remove tracking branches no longer on remote

Or the official documentation.

YesThatIsMyName
  • 1,585
  • 3
  • 23
  • 30
0

Yes, you can!

I think you need checkout branch what you need to deploy to new repo and push just this branch.

1.Checkout branch.

git checkout -b feature_branch_name Edit, 

2.Add and commit your files.

3.Push your branch to the remote repository:

git push -u origin feature_branch_name

4.Clone new repo to new folder

git clone new_repo_url new_folder
Alex_M6
  • 57
  • 1
  • 7