• 0 Posts
  • 8 Comments
Joined 1 year ago
cake
Cake day: June 4th, 2025

help-circle
  • In a terminal (or git bash) that’s set to the folder your project is in (cd /path/to/your/project or something like that)

    do this one time (per device):

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
    

    Otherwise git will yell at you to do that anyway. Otherwise:

    git init -b main
    This starts the whole repository with a branch (-b) called main.

    git add .
    Your git repository has nothing being tracked yet, this stages all of the files. (The . means everything in the current folder and below)

    git commit -m "text that describes the commit, like initial commit for the first one"
    You’ve “staged” the changes with add, this adds them to a “commit”.

    Normally git is local, if you want them in a remote repository - like github, gitea, forgejo, etc. you’d create the remote repository there, leave it empty, and add that remote to git.

    git remote add origin https://your-server/user/project.git
    you’ve added the remote repo called origin, why origin? It’s arbitrary, do it for shits and giggles and because you don’t have to think about it, it’s the conventional name. The link comes from github or whatever service.

    You now have the remote, you have your initial files added to a commit, to actually get them to the remote repo you need to push it.

    git push -u origin main
    That pushes the commit(s) to the remote “origin” on the main branch. Do that once per project and after that when you want to push your commits you just do git push.

    This is the sort of stuff all of the software like Godot or vs codium or whatever is doing in the background when you click the buttons.

    New project

    1. Make the repo
    2. Add the changed files (they’re all changed, the repo has no commits yet and is basically empty)
    3. Create the commit with a helpful message
    4. Push the commit.

    New changes

    1. Add changed files
    2. Create commit
    3. Push commit

    There’s more to it, like reverting back to old commits when something goes wrong, Using a .gitignore file to block staging files you don’t want to, fetching and pulling, and other things that can make git kind of hard at first.