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 ?

  • HeHoXa@lemmy.zip
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    15 hours ago

    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 dir

    git add -A register all files in the dir for change detection

    git commit -m "[message]" commit changes to those files locally

    git push push the local changes to the remote repo

    git fetch pull 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 with git 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.