How to organize project versions on Github?

Asked

Viewed 251 times

0

I have an old project that was written in Laravel 5.3, recently rewrote all the code using the version 5.5.

My question is how to organize this in Github, currently the master branch supports my project based on Laravel 5.3, locally I have the project rewritten in version 5.5

As a solution I thought about migrating version 5.3 to another branch and going 5.5 to master, however, I don’t know if this is how it works. If this is the way, how can I perform these steps?

  • Yes. That’s the way. Move the code with version 5.3 to another branch. For this use the command: git checkout -b 5.3 and then git checkout master to return to the branch main. There you can already overwrite with the new files. Faça o backup de tudo antes.

  • @Valdeirpsr after this action there would suffice a push?

  • Exactly. Then just run git push origin master to update branch principal or git push origin 5.3 to update the branch previous.

  • I understood this part, however I have the following doubt: currently I have in 1 directory version 5.3 and in another version 5.5, I keep working in separate directories or after this push I should move the content of 5.5 > the directory where is 5.3?

1 answer

1


I always use branches for that reason.

To use it too, use the command: git checkout -b 5.3 and then git checkout master to return to the branch leading.

I also always choose to leave everything in the same folder. No problem with that (except if you miss some command, for example, git push origin branch_errado).

When you use the command git checkout master, the files that are in the branch 5.3 are neither visible nor modifiable. And when you use git checkout 5.3 the files that are in the branch master shall not be visible or modifiable.

Creating branch 5.3 and creating a file

inserir a descrição da imagem aqui

Changing and viewing the master branch files

inserir a descrição da imagem aqui

If you execute the command git diff master 5.3, he will show you all the differences.

diff --git a/Agora estou no branch 5.3.txt b/Agora estou no branch 5.3.txt
new file mode 100644
index 0000000..e69de29

Back up everything before.

  • After performing this operation I can go back to working on master and then apply the change to both branches with git push at once?

  • Yes. You can do.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.