Vladimirtrif / Team-949z_Pelmen_Vex_21-22

0 stars 0 forks source link

How do I upload new code? #11

Open TarasAbakumov opened 2 years ago

TarasAbakumov commented 2 years ago

Am I supposed to write new code inside GitHub, or use something different like Visual Studio Code. If I do the latter, how do I upload the new changes?

vladsud commented 2 years ago

@TarasAbakumov, you can tag me in issues (by typing @vladsud anywhere) - that way I'll get notification and can respond to you right away. Tagging @Vladimirtrif in case he has other tricks and tips.

Here is what I'd recommend, but it's not the only way - there are a lot of tools in this space and a lot of documentation on the web and youtube in particular. Some of the steps you already did. Note that I'll describe "bare" process without any extra tools, and then add more posts about other tools.

Pre-steps:

  1. install git: https://git-scm.com/download/win
  2. Install VSCode: https://code.visualstudio.com/Download
  3. Launch console ("command prompt" or cmd.exe in Windows).
  4. Go to any folder where you want to create clone of code
  5. git clone https://github.com/Vladimirtrif/Team-949z_Pelmen_Vex_21-22
  6. cd
  7. code .

Now you can make local changes. When you think you are ready you can do something like that:

  1. git checkout -b
    • This will create local branch with the name you specify (instead of )
  2. git add *
    • This will "stage" all changed files. Only stages files can be committed. I.e., if you keep making changes after that point, they will not be included, unless you run this command again.
  3. git commit
    • This (for me) opens a commit file in VSCode where I can type description. Once I click commit button (second in a set of 4 in screen shot below), changes are committed locally image
  4. git push origin

The purpose to raise PR is to get feedback. Eventually, when everything looks right, you can merge it (click big green button in PR view) and merge it. This will submit your changes to main branch in github. You would need to do git pull origin main to get those changes back to your main branch on your laptop.

I'm sure it looks too complicated. But once you go through the process once, it's actually not that bad. The reason it's a lot of steps is mostly because of how git works - it's distributed version control system where you have full copy of everything (usually - most branches) on your local laptop, and you run these commands to push and pull changes between your laptop and github.com.

vladsud commented 2 years ago

VSCode has some git integration. You can click this botton: image It's 3rd button on the left rail: image

This will open source control tab that has some of the controls to create branches, switch between branches, stage, commit, etc. I do not use it that often (almost never), so I'll not give much advice here on usefulness, but I'm sure there are a lot of documentation on the web to help here if you want to use VSCode to do all of the above from VSCode

vladsud commented 2 years ago

I personally like UI tools, i.e. I like to review my own changes before committing them, sometimes picking up pieces or breaking big changes into smaller ones. So, I rarely use command line tools (i.e. mostly use them for trivial commands). There are many UI tools in this space, but IMHO they all suck in one way or another.

I use SourceTree: https://www.sourcetreeapp.com/ It requires some account to be created (free, I believe it's called "BitBucket"). You can connect it with github (it will guide you how to do it). But once installed, you get a nice UI tool where you can do all the key operations, like

All you need to do (after installing it) is

Their web site should have more info and details about tool.

I can demo you in person once lessons resume, but I hope this info above will be good skeleton to poke around at online documentation and fill in any gaps I might missed. But if you are stuck somewhere, tag me here with a reply and I'll do my best to unblock you

vladsud commented 2 years ago

Someone compiled a list of Git UX tools, in case you want to explore other tools. SourceTree is #1 in there: https://medium.com/quick-code/top-10-git-gui-clients-for-developers-b56d702579a6#:~:text=Git%20Cola%20is%20a%20sleek%20and%20powerful%20graphical,tools%20that%20are%20easily%20available%20for%20software%20developers.