https://www.theodinproject.com/lessons/foundations-git-basics this is the lesson that i am following. I completed the Create the Repository section successfully. I also completed the Use the Git Workflow section successfully. It’s the Modify a File or two where I am facing all the difficulties.
Can someone please show me the way how to do it ?
When I first started using Git, I was still in a phase where I wanted to completely understand every piece of tech I used inside out and upside down, line by line, function by function, every possible scenario.
Git is the thing that broke me of this habit. Never open the .git folder
Just learn the bare minimum handful of commands you absolutely need to get changes in, and manage the rest through the web ui
git clone [url]pull the repo to start. If you started locally, set up and clone the remote repo, then paste the files into the cloned dirgit add -Aregister all files in the dir for change detectiongit commit -m "[message]"commit changes to those files locallygit pushpush the local changes to the remote repogit fetchpull branch data from the remote repo (where you’ve set up branches in the web ui)git checkout [branch]swap to another branch. Any pending changes should be pushed or dropped first. Drop pending changes withgit checkout .Be very liberal with copy/pasting the whole solution out and in to overcome complex situations. Deleting the .git dir inside will detach the files from version control.
There are many desktop UIs that a lot of my peers like. The one baked into VSCode is nice. There are also many more elegant commands to overcome tricky situations. I never use them. Just the CLI and these few simple commands are enough to get whatever I need done and avoid butchering my history.
You’ll also need to know how to associate your local git client with your remote account, which I have to Google every time. Use SSH wherever possible because of how much smoother it is for the CLI. There’s a config flag to disable ssl checks for https commands that comes in handy in some corporate scenarios.
Probably not great advice, but I think fairly practical advice. Use at your own risk.
Can you explain what your overall goal is? By the looks of your recent post history, you seem to be overloading with new things. I would mention, if you’re just trying to learn git, there are windows ways you use git, so you don’t also have to learn Linux at the same time. I used tortoisegit for a long time, and github has an app. If you’re trying to learn programming in general, I would just use vscode in windows and not worry about git yet. Do you have a concrete idea of where you want to be in X time?
I’m doing the Odin Project course. I found it very useful for developing an overall idea regarding programming. But l am focussing on git because I wish to develop new things and collaborate on interesting projects.
You asked a very nice question indeed. I come from the arts background with no knowledge of science and technology. But life places you in weird positions. I don’t have any faith in the education system anymore, even though my brother is a teacher. And l hate big corporates. I believe that in the future, individuals would co-operate so far as work is concerned, and things of value would get created. We would be making things for our own needs, and people would help in this making process to alleviate their creative urge.
Do l make any sense to you ??
No that makes a ton of sense. I do definitely worry that you’re taking on too many complex adjacent things at once then. I myself use docker containers inside WSL to do dev work with Git and all these various things on a daily basis, but it took me a few years to feel comfortable like this. I think I would suggest you focus on the coding (python, javascript, etc etc) first and if it’s something that you can do in windows using just vscode, thats going to have less friction than trying to learn git at the same time as trying to learn command-line Linux. And once you feel comfortable with vscoding in windows, swap over to vscode in wsl, that way the IDE (vscode) is still familiar, but now you’re layering on the next level. And honestly, Git is pretty low on the stuff to learn. I know entire companies that do software version ingredients and sharing via email (aka, when Bob updates code he and Alice both use, he just emails her a copy) crazy, but it works for them.
On the other hand, this Odin project looks pretty well set up so that maybe after a couple weeks of feeling terrible, you pop out on the other side where it took me years to get to!
Could you narrow down which part is not making sense?
Which step are you struggling with?
If you click on the link, you’ll come across a section called modify a file or two. That is where my problems begin. So far, l’ve been working on my WSL terminal.
I did, there are multiple steps, which one is holding you up?
Point no. 1 itself.
so all it’s saying is open README.md and add something to it then save. Are you getting hung up with “use code .” as the example?
literally all you have to do is open the readme, add something to it like “hello world” or whatever, save it, do git add . then git commit -m “edited README.md” or something. git push. done.
IF you haven’t made a README.md yet then in your terminal just do “touch README.md” within your repo, then using whatever editor you use open it and do the above.
Exactly, this use code. I opened this lesson, and did everything on my WSL terminal. So far, so good. But when it’s this switching over, that’s creating the problem. Ideally, the readme.md has already been created by the time l reach here or no ? If not, where do I create the readme ? In the WSL terminal or the vs code terminal ?
Yesterday, l had made an attempt at it, and this was what my vs code terminal showed me : https://retrofed.com/post/1259307/comment/1601827#comment_1601827
You see the result in the pic of this post. Today l worked it up again, and today vs code gave the same result. Then l downloaded git separately for windows, and then configured it on vs code. I don’t know if l have done it in the correct way or not.
Anyways, l’ve shut down my system, and l shall look into it again tomorrow.
What a struggle trying to grasp a new idea !!!
wait WSL Terminal? so you’re using the Windows Subsystem for Linux?
I think you’re making this harder on yourself than you need to. It’s like you’re trying to use a saw to cut a piece of wood before knowing what wood even is.
I’ll be honest with you, don’t use VS code, you’re not ready for it. All you need right now is quite literally a regular windows terminal and a basic IDE. notepad++ or sublime text. ONCE you’ve learned the basics you can go back to VS Code, that VS Code terminal is gonna mess you up.
A. make sure you have git installed just open your windows terminal and do
winget install Git.GitB. again in the regular terminal navigate to your repo you’ve created.
C. open notepad++ or sublime text or whatever basic IDE you picked and create a README.md and save in your repos directory.
D. back in your terminal do
git add .make sure you have a space betweenaddand.E. then do
git commit -m "initial README.md commit"F. finally do
git pushand you’re done. you can then check it withgit statusand it’ll show there’s nothing to commit, everythings up to date.I think the tools were messing you up. I don’t recommend VS Code for beginners, it messes them up. keep it simple for now.
Somebody suggested me eclipse ide just now.
Ideally, the readme.md has already been created by the time l reach here or no ?
Depends, if you followed the tutorial precisely it should already have been created in the step “Create the repository 3.”. You can use the
lscommand in the WSL terminal to see if it exists.If not, where do I create the readme ?
In the base directory of the git repository you cloned from Github. You can do so with the command
echo "blaaaa" > README.md(this will overwrite the file if it exists already).In the WSL terminal or the vs code terminal ?
See I think this is your misunderstanding right here. The tutorial tells you to enter
code ., wherecodemeans “start VS Code” and.means “in the current directory”. You are supposed to then use the file explorer inside VS Code to select the README.md and modify it.This may not work as intended in WSL. If you enter
which codeand there is no output it won’t work. Is there any reason why you are using WSL instead of just installing git for Windows? It comes with a terminal emulator, so there should be no problem following the tutorial and you can eliminate WSL as a possible friction point.Thank you very much. I shall try tomorrow again. If WSL is not required, l won’t use it tomorrow. Now that l have installed git for windows, this entire work can be done on the terminal of vs code ?
Create the README.MD with touch and open the file with nano or your editor of choice.
touch README.md nano README.mdAdd
G'day gitExit nano with CTRL X then press Y to save the file.
I use vs code.
Assuming you are using the default layout. Right click on the folder structure on the left panel and select new file.
Then use it to save a READEME.md file in the git repository or directory.
whats the issue you have?
Git is about having a version of whatever project on a file in your computer (the file is called "local repository) and periodically synchronised its content with a remote file called central repository who is accessed potentially by other that you.
The first step is to make sure you have git, the software, on your computer and that you have access to a central repository, here GitHub where you need an account. Have you done that?
I already had git installed in my WSL. Today l downloaded and installed git in my windows 10 as well. I also have a GitHub account.
GitHub desktop takes the learning out of git. You press buttons. It does its thing.
I do have GitHub desktop, but haven’t used it yet.
Muuuuch easier than learning git.
So now you need to connect Git (the software on your computer) to GitHub (the internet site that will host the central repository). That is done using the command
git config
And giving it your github credential as mentionned in the Setting Up Git lesson that is link in the lesson you are following.





