| Post Reply | RetroFed Forum Forum Index » Hack The Planet Hub |
| Author | Message | ||
|---|---|---|---|
MastKalandar
feddit.online
MastKalandar@feddit.onlineJoined: 2026-04-28 |
@forestbeasts@pawb.social can you please suggest some tutorial where a noob can learn about working with git ?? |
||
| 3 Original | |||
FiniteBanjo
feddit.online
FiniteBanjo@feddit.onlineJoined: 2025-12-23 |
I'll do you one better, here is a list of tasks I want you to accomplish one at a time in order to familiarize yourself with git: understand that there are two parts to a git repo: the "remote" which is stored online such as CodeBerg or GitHub, and a "local" which exists on your computer. install a git bash console and enable the right click context for it Throughout the process please refer to this document: LINK right click within a new tutorial folder and open git bash OR open git bash manually and use create a git repo in this folder with Notice that git init created a new folder in your local repo, unless it's a hidden folder for whatever reason, called ".git" Also notice that the git add command has a little period in it, that tells the git add to add information about all of your files in the repo to the .git folder. You can also add files individually, or you can use Okay, we don't have any files to add! We have to make some! I want you to add a text file with a single line in it. Okay, now Now, project folders aren't just going to be lines of texts, obviously, so let's add a media file! It can be an image or a video (a copy or something that won't be missed). with the commands we used earlier, and customize the commit message yourself this time. UH OH! WAIT A MINUTE! Did your .git folder just increase in size dramatically? Oh dear, remote repos like CodeBerg only give you 750MB of space... We can't push this online! We need to keep the media files in our project file, but we need to make the git ignore the files! OH! I KNOW! LETS MAKE A Example of a .gitignore file for an UnrealEngine project, as a random example:
Note that this file would only work if the Git Repo were initialized in the same folder as these folders above, and not a level above them, otherwise you would have to add the parent directory to navigate to them. So, after you made an ignore file, let's test to see that it's working. Add another media file with the same extension type, which should also be listed in the git ignore, and if done correctly the Once we've managed to stop ourselves from adding the binary files, we can move on to the next step, removing the one we already added earlier! Using So we've added files, removed files, committed our changes with a helpful note, and everything is fine now. Except the .git file has NOT decreased in size. Like at all. It's even bigger, in fact. Fuck. There are a lot of ways to recursively remove unwanted files from the git history, but the easiest in my opinion is to make a backup, delete the .git file, git init all over again except this time your git add will follow the .gitignore properly from the start, and IF we were pushing the changes to an online repo this entire time then we would just push it again... Oh no! We're not allowed to push this new repo to the old repo because they're not the same repo anymore... Again, multiple solutions here, but the simplest is often the best for our purposes: If everything went well, the new .git file should be quite small, only recording changes to the text file, useful for programmers. Git is not made for sharing large or complicated files, but it technically can do so as long as you have permission from the git host. CodeBerg allows for 750MB, GitHub allows 1GB but only 100MB per individual file, you can also selfhost your own private git repo though which would allow you to host files in the repo exceeding such limits by far, but the size will continue multiplying as commits get made so it's still not a great idea. Generally, try to only add files for code or similar text/string based storage. Now log into CodeBerg, create a repo, obtain the URL to push to, and follow the instructions there ONE AT A TIME:
And FINALLY you can see... you're not authorized to push to this repo...? Ah, right, you're not using the Git Credential Manager and you didn't login in when you made the push command, so let's just press up on the keyboard to try that exact same push command a second time. It might open a tab in your default browser asking for permissions. Probably. Now try making a change to that text file earlier, followed by a At the start of every workday you use the If you and the other collaborators plan to make sweeping changes without interfering with each other's works, you can try making a new branch with Refer to the link near the start about combining, deleting, or overwriting branches. If you want to download an entire branch into a whole new folder, thereby making a backup of the remote repo, then use Great! Another thing to do, is to learn about how Garbage Collection works. Except we kind of bypassed that whole frustrating process earlier by simply deleting the garbage and the entire history by replacing it with a new garbage (which is really bad practice, btw). Oh, and you also need to find out how to deal with merge conflicts when both you and another user have made multiple commits which now need to be pushed and/or pulled. Good luck! |
||
| 1 | |||
MastKalandar
Moderator
MastKalandar@feddit.onlineJoined: 2026-04-28 |
I'll do you one better, here is a list of tasks I want you to accomplish one at a time in order to familiarize yourself with git: understand that there are two parts to a git repo: the "remote" which is stored online such as CodeBerg or GitHub, and a "local" which exists on your computer. install a git bash console and enable the right click context for it Throughout the process please refer to...
Thanks for those directions. |
||
| 2 | |||
|
ExtraMedicated
lemmy.world
ExtraMedicated@lemmy.world Joined: 2023-06-21 |
You might like this: https://learngitbranching.js.org/ |
||
| 1 | |||
MastKalandar
Moderator
MastKalandar@feddit.onlineJoined: 2026-04-28 |
You might like this: https://learngitbranching.js.org/ I thought it was kinda fun.
That's a lovely link, thanks 👍😊 |
||
| 2 | |||
| Post Reply |
Back to top |