VS Terminal / PowerShell Terminal / Git / Git Bash

So far, I’ve used git in Windows PowerShell. I’ve managed to create a few local repos and push them to GitHub. But, I have a LOT TO LEARN.

I’m finding git within PowerShell to be a bit cumbersome. I’ve seen references to Git Bash - and other interface tools - but don’t want to distract myself by looking into them UNLESS I’m wasting time and attention span on something that I will only want to replace later - such as Git Bash (or another tool).

I’ve been using a separate window tab for PowerShell, but I just read that I can access my terminal from within VS Code. That is appealing because navigation might be simplified. It seems at first glance that staying within the VS Code tab to write code and manage local and remote repos might simplify things.

So, what would you recommend for someone just beginning? . . . PowerShell terminal or VS Code terminal? . . . git or git bash?

tia

1 Like

I always use the terminal in VSCode, and you can open any kind of terminal you have available in the computer from there.
Here, the first screenshot is from using VSCode in the Linux environment and the other in Windows, to show that it allows to open the kind of terminal you have available in the environment

From there you use the kind of terminal you need for the task at hand.

1 Like

Install https://gitforwindows.org/. Use Git BASH. Keep it simple while you are learning.

2 Likes

I mostly use the intergraded terminal as well once inside a project.

But you often start in an external terminal, say when cloning a repo or whatnot. I would highly suggest installing Windows Terminal, it gives a lot of niceties, like tabs and a dropdown for starting the different shells and whatnot. Plus, it is handy when using WSL.

As said in your other thread, it is nice that Git Bash shows the branch you are on, so that is one reason to use it over PS. Although, you can set up PS to show more information.

https://git-scm.com/book/en/v2/Appendix-A:-Git-in-Other-Environments-Git-in-PowerShell

3 Likes

If you’re just starting with Git, here’s what I recommend:

  1. Use the terminal inside VS Code. It’s easier because you don’t have to switch between different windows. You can write code and manage Git in one place, which saves time.
  2. Stick with PowerShell for now. Since you’ve already been using PowerShell, there’s no need to switch to Git Bash unless you feel PowerShell is too hard or you run into problems. Both can do the same things with Git.
  3. Focus on learning Git basics. The tool (PowerShell or Git Bash) doesn’t matter as much as understanding how to use Git itself. Commands like git init, git add, git commit, git push, and git pull are the same no matter what terminal you use.

For now, use the VS Code terminal with PowerShell.

2 Likes

I thought I had this figured out but I need help.

I created a new project on my Windows PC. When I got the project to its first completion point, I created a local repo. I think these were the steps I followed (in case it matters):

  • change directory to project’s root directory on local PC
  • entered git init
  • entered git add .
  • entered git commit
  • entered git status and got message saying nothing to commit working tree clean

I think the local repo is ok because I got:

create mode 100644 Styles/lineage.css
create mode 100644 index.html

which are the 2 files in my project at this point.
Next I logged into GitHub with my browser and created a new repo of the same name as my local project with a README.md file.

I went back to git thinking I was ready to get things moved to gh. I entered ```
git remote add origin GitHub - RHH42/Lineage-Project: Part of The Hutchins Clan Project

and got no error.

I then tried to enter a git push origin main command but got

error: failed to push some refs to 'https://github.com/RHH42/Lineage-Project'

On searching that error I found references to working on a project with others which I didn’t understand. I then did a git status command and got the response

On branch master nothing to commit, working tree clean

I then opened GH in my browser to see if any of the project files were there. They were not, only the main branch and the README files appear there.

I probably missed a step or did something wrong in steps I took. As I understand it, there is no ‘add’ command or ‘commit’ command used to move files to the GH repo, that only the push command is used. Was my syntax git push origin main wrong? It was issued with the terminal directory set to my project’s root folder.

With a lot more digging and a call to a friend, I found the answer.

For reasons I don’t understand, I had to create a branch in the remote repo called master. After doing so I was able to make the push: git push origin master. A git remote -v returned a display of the files in the remote repo.