The goals
💪🏻Understand "Version Management" / "Version Control"
✌🏻Getting started with Git Repositories, Branches, Commites & more
👍🏻 Collaborating in Git projects with GitHub Remote Repositories, Clone, Pull Requests & More
What is Version Management / Control?
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time. As development environments have accelerated, version control systems help software teams work faster and smarter. They are especially useful for DevOps teams since they help them to reduce development time and increase successful deployments.
Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.
What are Git & GiHub?
Git: Git is a distributed version control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
GitHub: GitHub is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.
GUI vs CLI
CLI is the word form used for Command Line Interface. CLI permits users to put in writing commands associate degree exceedingly in terminal or console window to interact with an operating system. CLI is a platform or medium wherever users answer a visible prompt by writing a command and get the response from the system, for this users have to be compelled to kind command or train of command for performing the task. CLI is suitable for pricey computing wherever input exactitude is the priority.
GUI stands for Graphical User Interface. GUI permits users to use the graphics to interact with an operating system. In the graphical user interface, menus are provided such as windows, scrollbars, buttons, wizards, painting pictures, alternative icons, etc. It’s intuitive, simple to find out, and reduces psychological feature load. In GUI, the information is shown or presented to the user in any form such as: plain text, videos, images, etc.
Git Basics - Theory
First, Git handles content in snapshots, one for each commit, and knows how to apply or roll back the change sets between two snapshots. This is an important concept. In my opinion, understanding the concept of applying and rolling back change sets makes Git much easier to understand and work with.
note
We can use ':x' to exit in git terminal setting status!
git add.
git commit -m "added test.txt file"
git config --global --edit
:x
git config --global user.name
(then we will see the user name)
git config --global user.name "Olivia"
(then we will set the user name as 'Olivia')
git config --global user.email
git status
(to check our snapshot saved well)
git log
git branch
git branch -m main
git checkout -b feature
git branch
git add.
git commit -m "added new feature directory"
git log
git merge feature
git checkout -b delete
git add.
git commit -m "added file1.txt"
clear
(we can just directly delete in on working directory)
or just move into the folder has a file we wanna remove and,
git rm file2.txt
clear
git status
git add .
git commit -m "deleted file2 and file3"
git status
git log
git reset
git reset --hard HEAD~1
(we will head back one commit, we delete the latest commit)
git branch
git branch -D feature
(because we already merged feature branch into main branch)
git checkout -- .
(to remove unstaged change)
(but what if we already added but wanna remove?)
git reset file1.txt
git status
(then this file is unstaged)
git checkout -- .
or
git checkout -- file1.txt
Why we use github?
GitHub is an online software development platform used for storing, tracking, and collaborating on software projects. It enables developers to upload their own code files and to collaborate with fellow developers on open-source projects. GitHub also serves as a social networking site in which developers can openly network, collaborate, and pitch their work.
GitHub allows software developers and engineers to create remote, public-facing repositories on the cloud for free. Once you’ve set up a repository on GitHub, you can copy it to your device, add and modify files locally, then “push” your changes back to the repository where your changes are displayed to the public.
So, why would you prefer GitHub over developing with a private repository? Here are the key reasons why GitHub is such a big player:
Enhanced Collaboration
The single biggest selling point of GitHub is its set of project collaboration features, including version control and access control.
To illustrate what’s possible with GitHub, imagine this scenario: You want to code up an online game, and you enlist your friend to help you. You create a repository on GitHub that stores all the files, including current and past versions, then give your friend collaborator access to this repo as well.
You decide to work on the main gameplay and screens while your partner tackles the game’s menu and settings screens. In order for you both to push your changes at the same time without interfering with the other’s work, you create a branch — a separate development area — where your teammate can build out their screens. Meanwhile, you continue work in your branch.
Once your friend finishes their work, they can make a pull request asking to combine their work with yours. If you approve, you can merge your branches, and thus your code.
Now, say another developer sees your game’s repository and has an idea to add multiplayer mode. They can fork — or make their own copy of — your repository, then add their new features. Once finished, they can submit a pull request to you. If you approve, this forked repository merges with yours, and your game is now multiplayer! Note that anyone can fork a public repository, but it's up to the repository owners to accept or reject pull requests.
Of course, no software is perfect on the first go, which is why your GitHub repo also has an Issues section for listing to-dos and reporting problems with your game, discussing them, and marking them resolved. To address these issues, you might look back at a file’s changelog to see when and where things went wrong.
To sum up, GitHub provides a centralized space where several, dozens, or even thousands of developers can seamlessly contribute to a project, without worrying about overriding anyone’s work or losing track of changes.
Easy File Management
GitHub adds a sleek graphical user interface (GUI) layer on top of Git. On its own, Git operates through the command line (a computer’s text-based interface). Developers know how to use the command line, but for many, it’s not always the most efficient way to interact with files.
GitHub’s interface provides a clean and user-friendly means to perform Git actions as well as view file history. This is more convenient for developers and more accessible for beginners getting the hang of Git.
Another benefit that makes GitHub more accessible is its cloud-based infrastructure. A GitHub user may access their repository from any location and any device, download the repository, and push their changes. Using GitHub means you’re not limited to one device or environment.
Social Networking
Any GitHub user knows the platform is more than just a place to work on code. All GitHub users have profiles to display their projects, contributions, and activity on the site, and can see anyone’s public-facing profile and repositories.
Image Source
GitHub’s social network is critical to its success, as it encourages developers to explore and contribute to open-source projects of all kinds. Previously, aspiring collaborators would have to personally reach out to project owners asking for permission to contribute. With GitHub, it’s as easy as forking a project and then making a pull request. A project owner can then vet someone’s profile and past contributions before accepting their request.
GitHub also serves as a way to showcase projects for employers, acting as a portfolio of sorts. For example, recruiters often use GitHub to scout talent, since prospects’ code is available for anyone to review.
Open-Source Projects
Thanks to the benefits we’ve learned about, GitHub has fueled a surge of open-source collaboration, leading to the creation of many widely used software technologies. From CSS frameworks to data visualization libraries to a game you might spend too much time playing, a lot of impressive feats wouldn’t be around without open GitHub repositories.
As has been a trend with Web 2.0, GitHub has also opened up software development to anyone who wants to learn programming, fostering an engaged, innovative, and productive community.
Private Repositories
Sure, that’s all great, but how does GitHub make money if everything is free and open-source?
The answer is that GitHub provides paid services as well, including private repositories. On a paid plan, teams can collaborate on GitHub while keeping their code behind closed virtual doors. GitHub also offers enterprise solutions that equip organizations with internal collaboration tools.
Git personal access token?
Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line.
when we create the token we can select scopes with...
repo
workflow
write:packages
delete:packages
gist
notifications
user
delete_repo
write:discussion
Git clone?
Git clone is used to copy an existing Git repository into a new local directory.
The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally. By default, Git clone will create a reference to the remote repository called origin.
git credential-osxkeychain erase host=github.com
protocol=https
Git fork vs clone
When a Git repository is cloned, the target repository remains shared amongst all of the developers who had previously contributed to it. Other developers who had previously contributed to that codebase will continue to push their changes and pull updates from the cloned repository. Any developer who clones a repository can synchronize their copy of the codebase with any updates made by fellow developers.
In contrast to a clone, a Git fork operation will create a completely new copy of the target repository. The developer who performs the fork will have complete control over the newly copied codebase. Developers who contributed to the Git repository that was forked will have no knowledge of the newly forked repo. Previous contributors will have no means with which they can contribute to or synchronize with the Git fork unless the developer who performed the fork operation provides access to them.
Sources
https://www.geeksforgeeks.org/difference-between-cli-and-gui/
Difference between CLI and GUI - GeeksforGeeks
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
www.geeksforgeeks.org
https://developer.ibm.com/tutorials/d-learn-workings-git/
Learn the workings of Git, not just the commands
Learn how Git works and how it all fits together, so you don\'t have to try to remember the commands, but instead just know what to do because you understand it well.
developer.ibm.com
https://blog.hubspot.com/website/what-is-github-used-for
What Is GitHub? (And What Is It Used For?)
Discover what GitHub is, what it's used for, and why it's the most important platform in the open-source development community.
blog.hubspot.com
Creating a personal access token - GitHub Docs
Notes: If you use GitHub CLI to authenticate to GitHub on the command line, you can skip generating a personal access token and authenticate via the web browser instead. For more information about authenticating with GitHub CLI, see gh auth login. Git Cred
docs.github.com
https://www.gitkraken.com/learn/git/git-clone
Git Clone | Create a copy of an existing Git repository
Git clone allows you to copy an existing remote repository onto your local machine. See examples for how to clone a repository using SSH and HTTPS.
www.gitkraken.com
'2022 Web Development Bootcamp' 카테고리의 다른 글
Section 08: Understanding Responsive Design (One Website - Different Devices) (0) | 2022.08.17 |
---|---|
Section 07: Understanding Layouts & Positioning (0) | 2022.08.15 |
Section 05: Hosting Our First Website! (0) | 2022.08.09 |
Section 04: HTML & CSS Basics: Summary & Practice (0) | 2022.08.09 |
Section 03: Diving Deeper into HTML & CSS (0) | 2022.08.09 |