Learning Git! - bounswe/bounswe2025group10 GitHub Wiki
Welcome to our Git wiki page! Here, each contributor will explain how they learned Git, share practical examples, and provide tips for beginners. We hope this page will serve as a guiding resource for anyone who wants to understand and master Git.
👉 For a detailed description on pull-requests and how they are used in practice, check out our Learning Pull Requests!.
I learned Git primarily through YouTube, especially via this helpful tutorial:
How to Use Git
I was also familiar with Git thanks to various Computer Engineering courses, such as CMPE230. During those courses, I explored concepts like branching, which allows me to work on a new feature independently and then merge the completed changes back into the main branch using the git merge
command.
For example:
- Create a new branch:
git checkout -b feature/awesome-feature
I learned Git through a combination of online tutorials and hands-on experience in software development projects. One of the most useful resources for me was this interactive Git tutorial:
Learning Branching
One interesting Git fact I discovered is that you can undo almost any mistake using git reflog
. This command tracks every action you take in Git, allowing you to recover lost commits, reset to previous states, and even retrieve deleted branches.
For example:
- View the history of recent Git actions:
git reflog
- Reset to a previous commit safely:
git reset --hard HEAD@{2}
This has saved me many times when I accidentally committed something wrong.
I learned Git via AI and YouTube tutorials. Also I have been in team projects that required me to use Git frequently.
Here are the commands that we will be using most of the time:
-
Pull the latest changes
git pull origin main
-
Commit your changes
git add . git commit -m "Your change goes here"
-
Push changes to main
git push origin main
Important: Always run "git pull" first to avoid conflicts.
I learned the basics of Git from a crash course video Git & GitHub Crash Course For Beginners This introductory resource taught me essential Git concepts, such as repository cloning, branching, and committing changes. Example workflow:
# Firstly switch to your branch you want to work on (if not create one with git branch <branch_name>)
git switch <branch_name>
# Pull the latest changes from desired branch(generally main)
git pull origin <branch_name>
# Changed your files and stage them
git add .
# Commit them
git commit -m "<message>"
# Push changes to your desired branch
git push origin <branch_name>
At work, I have further enhanced my skills by applying Git to various projects. I primarily use Git through the Visual Studio extension, which accelerates my workflow by visually displaying changes and differences in the code. When needed, I also use the terminal for direct command-line operations. With visual studio extension, you can directly stage your changes and commit them:
This combination of self-learning through online resources and hands-on experience at work has solidified my understanding of Git, enabling me to efficiently manage version control and collaborate on projects.
I learned git through Youtube tutorials such as Git and GitHub Tutorial for Beginners by Kevin Stratvert and Git Tutorial for Beginners: Learn Git in 1 Hour by Programming with Mosh.
I also had some experience with Git in previous CMPE courses and in my internship. In the previous courses I learned about the concepts of "What is a repository?" and "How to use a repository by commits, pushes, cloning, etc. Meanwhile, during my internship I got to use branches and pull requests.
One useful thing we can use in git is to create a ".gitignore" file in order to make git not track some unnecessary or secret files.
For Example:
We can create this .gitignore file in order to make git not track the Images file and a text file named "secret.txt" in the root folder:
# Ignores the Images file in the root directory.
# If we remove the first "/" it would ignore every directory named "Images" in any level
/Images/
# Ignores the secret.txt directory in root.
/secret.txt
Another thing which is useful about arranging issues and/or pull requests is using the projects tab in Github. For example we can create a project for a feature to implement and add relevant issues to that project, adding them to "Todo", "In Progress", "Completed, or some custom columns.
I learned GitHub primarily through a blend of official documentation and engaging YouTube tutorials. One of the most comprehensive resources was the official GitHub Docs (docs.github.com/en), which covers topics ranging from repository management and collaboration workflows to advanced features like GitHub Actions. I also gained practical insights from these two YouTube tutorials:
Git and GitHub for Beginners - Crash Course
Git & GitHub Crash Course 2025
These resources taught me several key concepts. For instance, I learned about the git clone command which is fundamental in Git for creating a local copy of an existing repository. It copies not only the files but also the entire commit history, branches, and tags from the remote repository, allowing you to work on the project offline or modify it on your local machine:
git clone https://github.com/username/repository.git
I also discovered how pull requests not only facilitate code reviews and discussions among team members but also ensure that only well-vetted changes are merged into the main branch.
Together, these resources have provided me with a solid foundation in using GitHub for version control, collaboration, and automation in real-world projects.
I learned Git and GitHub by taking a course in BTK Akademi. The course link is here: (https://www.btkakademi.gov.tr/portal/course/versiyon-kontrolleri-git-ve-github-19439)
Here is a quick summary:
-
git init
- Initializes a new Git repository. -
git add
- Stages changes for the next commit. -
git commit
- Saves staged changes with a message. -
git status
- Shows the current state of the working directory and staging area. -
git log
- Displays the commit history.
-
git branch
- Lists all branches in the repository. -
git branch <branch_name>
- Creates a new branch. -
git switch <branch_name>
- Switches to the specified branch. -
git merge <branch_name>
- Merges the specified branch into the current branch.
-
git restore
- Discards changes in the working directory. -
git checkout <commit_id>
- Switches to a specific commit (deprecated in favor ofgit switch
). -
git reset <commit_id>
- Moves the HEAD to a specific commit, keeping changes. -
git reset --hard <commit_id>
- Moves the HEAD to a specific commit and discards all changes. -
git revert <commit_id>
- Creates a new commit that undoes a previous commit.
-
git diff <commit_id> <commit_id>
- Shows the differences between two commits.
-
git remote add origin <url>
- Links the local repository to a remote repository. -
git push origin <branch_name>
- Pushes local commits to a remote branch.
-
git fetch
- Downloads updates from the remote repository without merging. -
git fetch origin <branch_name>
- Downloads the latest updates of the specified branch (<branch_name>) from the remote repository (origin) without merging. (Useful for examining changes before merging.) -
git pull
- Fetches and merges updates from the remote repository.
-
git clone <url>
- Creates a local copy of a remote repository.
- Used to propose changes from one branch to another, usually for review.
- Creates a copy of a repository under your GitHub account to make independent changes.
- Fork the repository.
- Clone the forked repository locally.
- Make changes and push them to the remote repository.
- Create a pull request on GitHub.
I learned Git through a mix of online courses, hands-on practice, and real-world projects. Additionally, my experience in my summer internship helped reinforce my understanding of Git's core concepts.
One of the most useful Git commands I frequently use is git stash
. This command allows you to temporarily save changes without committing them, which is especially helpful when switching between tasks without losing progress.
- Stash your current changes:
git stash
- View the list of stashed changes:
git stash list
- Apply the latest stashed changes:
git stash apply
Another interesting aspect of Git that I find useful is rebasing, which helps maintain a cleaner commit history by integrating changes more linearly. Instead of merging, you can use:
git rebase main
to move your branch on top of the latest main
branch commits.
I learned Git primarily through YouTube tutorials—one particularly helpful example is this video, which does an excellent job of explaining Git's fundamental commands. In addition to online tutorials, I gained practical experience with Git through our previous CMPE courses, personal projects, and my summer internship. I also frequently consult the Git documentation on git-scm.com for learning new commands and reviewing the details of ones I already know.
One Git command that I find especially useful is git bisect
. This command can be a lifesaver when tracking down a bug introduced in your code, as it uses a binary search approach to quickly pinpoint the problematic commit. Below, I will explain how to use it:
- Begin by telling Git you want to start bisecting:
git bisect start
- If the bug is present in your current commit, mark it as bad:
git bisect bad
- Choose a commit where the bug was not present and mark it as good:
git bisect good <commit-id>
- Test intermediate commits: Git will now checkout a commit roughly halfway between the known good and bad commits. Test your code and if the bug exists, mark it as bad:
git bisect bad
otherwise if the bug is absent, mark it as good:
git bisect good
-
Repeat 4th step until Git pinpoints the exact commit that introduced the bug
-
Once you’ve identified the problematic commit, reset bisect mode:
git bisect reset