I have noticed that on my laptop, it lets me initialize repositories and use source control in visual studio code. But when I go to source control on my main PC, it tells me to download git for windows.
On my laptop I have never downloaded git but now on my pc I have to.
Has anyone had this issue before?
So I downloaded git as it said and it tells me that I can reopen closed repository. So I downloaded git as it said and it tells me that I can reopen closed repository.
before downloading git:
after downloading git:
if i press reopen repository:
That repository doesn’t even open.
2
Answers
As far as I know, Git is not built into VS Code.
Indeed, from the official docs at https://code.visualstudio.com/docs/sourcecontrol/overview#_working-in-a-git-repository:
If on one of your machines you were able to use the Git support of VS Code, that means Git was already installed before you got it, or that sometime when you had it, it was installed.
For macOS, see Is git pre-installed on macOS Sierra? and Is git already installed when buying a new Macbook?. TL;DR it comes with a shim that prompts you to actually install Git.
It is likely that your VS Code installation installed it by default. Normally you need to install a Git Client on your computer and enable it for VS Code if you are using it.
Additional details
Please continue to read if you are new to the concept of Git to understand the big picture better.
Git is a distributed version control system that lets developers track source code changes during software development. It is fast and super flexible. You can create as many branches as you need and switch between branches as you wish.
Distributed Version Control System means Git has a remote repository which is stored on a server and a local repository which is stored on the computer of each developer. This means the code is not just stored on a central server, but the full copy of the code is present on all developers’ computers (assuming they all pulled the latest code to their computers).
In order to work with a Git repo, you should install a Git Client.
A Git client is a software application that allows you to interact with a Git repository. You can use a Git client to perform actions such as committing changes, creating branches, merging changes, and more. Some popular Git clients include Git CLI, GitKraken, and SourceTree. A lot of developers prefer to work with applications like Git Bash, Command Prompt or PowerShell on Windows and Homebrew, MacPorts, Xcode on macOS.
Bonus
Quite a few people prefer to work with a Git GUI client which is a powerful alternative to command line options like Git Bash. I personally recommend you to get used to working with a command line tool. Below are the most common bash commands.
Set global settings for user information
Check status
Clone a project and working with branches
Creating a new branch
Renaming an existing branch
Long version of renaming a branch (from bugfix to feature in this example)
Short version of renaming a branch (from bugfix to feature in this example)
Adding changes for commit
This is for adding a single file, following 2 commands are adding all allowed changed files
Committing and pushing
If the branch is newly created.
Changing the most recent commit message
Pull, fetch and merge
Reset changes
Undo the last commit, do not keep the changes.
Undo the last commit, keep the changes.
Show all ignored files
Check local, remote and all branches
Delete a local branch
Delete a remote branch
Tag checking and creation
Start using SSH in a repository where I am currently using HTTPS
Stash changes
Save the un-committed changes in a "stash". This will remove changes from working tree.
List the stashes
Apply stash to working tree in current branch
Apply the stash 0 – change the number in order to apply other stashes
Remove the stash 0 from stash list – change the number in order to apply other stashes.
Apply the selected stash and remove it from the stash list.
Show all commits of the current branch as well as the parent branch and its commits
Exit git log history
For exit
For help