If you are starting a new project, and want to use Git for source control, you first need to create a new repository. Learn how you can get started initialising a new Git repository, and then look at some conventions that all code repos should adopt.
vim has various different modes, insert being one of them. To get into insert mode press i, at which point itâll behave like you would expect a text editor to behave. To leave that mode press esc. You can then use command mode to do things like jump to particular lines (e.g. line 3 :3), or save and quit (:wq).
I donât think Iâve done anything special with my vim setup at all. I think that the hyperlink highlighting comes from the fact that Iâve enabled syntax highlighting in my ~/.vimrc, and that Iâm editing a markdown file.
You can enable syntax with the following in command mode (i.e. press ESC first):
This is referring to how to get out of this screen. less is the name of a command line program that allows you to page through text files. To quit and return to the prompt, type the letter q.
I got the message at the bottom. Not sure what to do about it. I am new to terminal and Git so probably messed something up. Any help would be appreciated.
C:\Users\tom\OneDrive\Desktop\tomsTODOs.git>ls -la
total 15
drwxr-xr-x 1 tom 197611 0 Jul 15 13:56 .
drwxr-xr-x 1 tom 197611 0 Jul 15 13:40 âŠ
-rw-râr-- 1 tom 197611 23 Jul 15 13:40 HEAD
-rw-râr-- 1 tom 197611 1074 Jul 15 13:56 License
-rw-râr-- 1 tom 197611 130 Jul 15 13:40 config
-rw-râr-- 1 tom 197611 73 Jul 15 13:40 description
drwxr-xr-x 1 tom 197611 0 Jul 15 13:40 hooks
drwxr-xr-x 1 tom 197611 0 Jul 15 13:40 info
drwxr-xr-x 1 tom 197611 0 Jul 15 13:40 objects
drwxr-xr-x 1 tom 197611 0 Jul 15 13:40 refs
C:\Users\tom\OneDrive\Desktop\tomsTODOs.git>git status fatal: this operation must be run in a work tree
Sorry to see youâre having problems. Itâs not immediately clear to me quite what youâve done to achieve it, but I can talk a bit about what youâre seeing.
When you create a git repo, itâs just a directory. And then inside that directory, git creates a hidden directory, called .git. Thatâs where it stores all the history information, and loads of other bits and pieces it needs to operate.
The directory listing youâre showing me there is what the inside of one of those .git directories looks likeânot the git repo itself.
The error youâre seeing is telling you that youâre not inside a git repo (a âwork treeâ), but instead inside the magical git directory itself.
However, looking at the directory structure you have, I donât know how you managed to create it! The only thing I can think of is that git automatically created it looking like that, because you named the directory tomsTODOs.git instead of tomsTODOs, although that doesnât seem to be the case when I tested it. Or maybe you ran git init whilst in the Desktop directory, and then renamed the .git directory that appeared?
Do you remember the commands you used?
I would suggest trying something like this and you should be ok:
> cd C:\Users\tom\OneDrive\Desktop
> mkdir tomsTODOs
> cd tomsTODOs
> git init
This will create a directory called tomsTODOs on the desktop, and then initialise it as a git repo.
Thanks, although I only understood part of what you said, I followed your instructions and it worked. Please see below.
It seems being a GUI addict has seriously affected my ability to soak in something the first time.
Thanks for your help!
C:\Users\tom\OneDrive\Desktop>mkdir tomsTODOs
C:\Users\tom\OneDrive\Desktop>cd tomsTODOs
C:\Users\tom\OneDrive\Desktop\tomsTODOs>git init
Initialized empty Git repository in C:/Users/tom/OneDrive/Desktop/tomsTODOs/.git/
C:\Users\tom\OneDrive\Desktop\tomsTODOs>git status On branch master
No commits yet
nothing to commit (create/copy files and use âgit addâ to track)