-
Notifications
You must be signed in to change notification settings - Fork 1
Research on Git
Git is the most popular version control system in the world. A version control system records the changes we made to our code over time in a special database called a repository. With the help of this control version, we can look at our project history and see who has made what changes, easily communicate the changes in the project with our group members. We can easily revert our project back to an earlier state which makes our job way easier because otherwise, we would have to constantly store copies of the whole project in various locations, and tracking the contributions of other team members would be extremely difficult. Version control systems fall into two categories: Centralized and Distributed. Git is an example of a distributed version control system.
On the other hand, Github is a Git repository hosting service, which provides a web-based graphical interface and it helps every team member to work together on the project from anywhere and makes it easy for them to collaborate.
- There are three main components of a Git project:
- Working tree (workspace)
- Index (staging area)
- Local repository
- Remote repository
- The
HEAD
in Git is the pointer to the current branch reference. - Git Merge Mechanisms:
- Fast forward merge can be performed when there is a direct linear path from the base branch to the target branch, that is, if no new commits were made to the base branch since our branch was created, Git can do something called a “Fast Forward Merge”. This is the same as a Merge but does not create a merge commit.,,
- Recursive merges are the default for any merges that aren’t fast-forward merges. These types of merges operate on two different heads using a three-way merge algorithm. The merge commit ends up having two parents once the merge is complete.
First, set up your environment to use Git.
-
git config --global user.name "[name]"”
: Configure your Git user name.
-
git config --global user.email "[email]"
: Configure your Git email address you will be using.
-
git config --global color.ui auto
: Set automatic command line coloring for Git for easy reviewing.
Initialize your working directory.
-
git init
: Initialize an existing directory as a Git repository. -
git clone [url]
: Retrieve an entire repository from a hosted location via URL.
These are the most commonly used Git commands while working on a repository.
-
git status
: Shows the status of changes as untracked, modified, or staged. -
git add [file]
: Add a file to commit. -
git push
: Push the committed files to the repository. -
git pull
: Fetch the updated content in the remote repository to your local environment. -
git rm
-
git rm --cached [filename]
: Removes the given file from the staging area.--cached
flag makes this command remove the file only from the Git repository, but not from the filesystem.
-
git rm -r --cached [files]
: Remove more than one file recursively.
-
-
git log
git log --oneline
git log --oneline --decorate --graph --all
-
git show [hash]
: Displays detailed information about a commit with the given hash. -
git restore
-
git restore --staged [filename]
: Removes the file from the staging area, but leaves its actual modifications untouched. -
git restore [filename]
: Restore the file to its last state in Git by discarding the uncommitted local changes in it. If file is recently added, then this operation may delete the file.
-
-
git commit
-
git commit -m "message"
: Commit the staged files and add a message. -
git commit -a -m "message"
: Commit staged and unstaged files (by staging them) and add a message. -
git commit --amend -m "message"
: Changes the description of the most recent unpushed commit. Although content doesn't change, hash of the commit changes. -
git commit -m "message" -- [path of the file]
: Commit only a certain group of file(s) from the stage area. (Useful command I found out while working, can be used to improve the readability of commits)
-
-
git tag
: See the current tags.-
git tag [tag] [hash] -m "message"
: Tag the commit with the given hash and put a message. -
git push [tag] origin
: Push the tag to the remote repository. Tags can be observed on Github.
-
-
git branch
-
git branch
: List local branches. -
git branch -a
: List all he branches. -
git branch --remotes
: List remote branches. -
git branch [branch]
: Add a new branch with the specified name. -
git branch -d [branch]
: Delete the given branch. -
git checkout [branch]
: Swap to another branch. -
git merge [branch]
: Merge the specified branch to the current branch we are working on.
-
-
git checkout [branch]
: Change your currently active branch to the branch with the given name. -
git stash
: Let's say you have developed a new functionality for your project in thedev
branch. However, you want to commit your recent contributions to another branch, you forgot to switch branches beforehand. In such a scenario, you can do the following in order to avoiddev
from tracking the changes:git stash git checkout other-branch git stash pop
- After merging a Pull Request, you can delete the branch in the remote repository (here in this repo).
In order to delete it from local, you can follow these steps:
- Delete the local branch using
git branch -d <branch>
. After this step, if you see thatremotes/origin/branch
still exists, then do the following: - Delete the remote branch that doesn't have any correspondence in remote repository:
git fetch --prune
- Delete the local branch using
-
git branch -vv
: Lists your local branches along with the remote branches they are tracking.
- Git For Ages 4 and Up
- Git - Command Line Basics
- Git vs. Github: What's the difference?
- Github Tutorial For Beginners -Very good introduction to git&github. -Explains the motivation behind git. -Gives easy to understand practical examples.
- Git Cheat Sheet
- Github Docs
- Git - 50 Git Commands You Should Know
- An Intro to Git and GitHub for Beginners (Tutorial) -Concise yet intuitive explanations. -Step by step instructions with visuals of the code. -Could be a great starting point to follow along, when trying one's hand at git. -Also offers additional advice and links at the end for common difficulties and further improvement.
Home 🏠
- Conventions
- Elevator Pitch
- Project Description
- Project Plan
- Scenarios and Mockups
- Requirements
- Diagrams
- Milestone Report I
- Serdar Akol
- Sena Mumcu
- Karahan Sarıtaş
- Mustafa Cihan
- Serhat Hebun Şimşek
- Elif Bayraktar
- Doğukan Türksoy
- Furkan Keskin
- Sinem Koçoğlu
- Metehan Dündar
- Mustafa Emre Erengül
- Favourite Github Repositories
- Research on Git
- Research on Art Community Platforms 🎨
- Research on Django
- Research on Docker 🐳
- Research on AWS EC2 ☁️
- Research on Postman
- Research on Frontend Tools
- Django Practices 💯
- Serdar Akol
- Sena Mumcu
- Karahan Sarıtaş
- Mustafa Cihan
- Serhat Hebun Şimşek
- Elif Bayraktar
- Doğukan Türksoy
- Furkan Keskin
- Sinem Koçoğlu
- Metehan Dündar
- Mustafa Emre Erengül
- Week1 - Meeting #1 (04.10.2022)
- Week2 - Meeting #2 (11.10.2022)
- Week2 - Meeting #3 (16.10.2022)
- Week4 - Meeting #4 (25.10.2022)
- Week5 - Meeting #5 (02.11.2022)
- Week9 - Meeting #6 (29.11.2022)
- Week10 - Meeting #7 (07.12.2022)
- Week 3- FE Meeting #1 (18.10.2022)
- Week 5- FE Meeting #2 (02.11.2022)
- Week 7- FE Meeting #3 (15.11.2022)
- Week 3- BE Meeting #1 (18.10.2022)
- Week 5- BE Meeting #2 (02.11.2022)
- Week 7- BE Meeting #3 (15.11.2022)
- Week 9- BE Meeting #4 (29.11.2022)
- Week 11- BE Meeting #5 (13.12.2022)
- Week 3- MOB Meeting #1 (18.10.2022)
- Week 5- MOB Meeting #2 (02.11.2022)
- Week 7- MOB Meeting #3 (16.11.2022)
- Week 8- MOB Meeting #4 (26.11.2022)
- Week1 - Meeting #1 (01.03.2022)
- Week1 - Meeting #2 (05.03.2022)
- Week2 - Meeting #3 (09.03.2022)
- Week2 - Meeting #4 (13.03.2022)
- Week3 - Meeting #5 (20.03.2022)
- Week4 - Meeting #6 (23.03.2022) Customer Meeting - I
- Week5 - Meeting #7 (01.04.2022)
- Week5 - Meeting #8 (04.04.2022)
- Week5 - Meeting #9 (05.04.2022)
- Week6 - Meeting #10 (06.04.2022) (PS)
- Week6 - Meeting #11 (12.04.2022)
- Week7 - Meeting #12 (14.04.2022)
- Week9 - Meeting #13 (26.04.2022)
- Week10 - Meeting #14 (01.05.2022)
- Week11 - Meeting #15 (10.05.2022)
- Week11 - Meeting #16 (15.05.2022)