Â
Â
- Introduction to Git
- Git commands
- Errors
- Git PURR!
- Other tools and tips
- References
- Readme in other languages
- Contributors
Â
Git is the main version control system used in the world. Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
This provides many advantages like multiple people working on the same project asynchronously, testing changes to a system without having to worry about reverting to a previous state if necessary, compare changes in files, maintaining different versions of the same system on the same place but separate, keep a history of changes for future reference, among others.
Debian/Ubuntu:
apt-get update
apt-get install git
Arch Linux:
pacman -S git
It is entirely possible to work with git locally on your machine without other contributors, since some of the benefits of git are keeping track of changes in time, so to clarify there's a separation between git and platforms like GitHub, GitLab, or Bitbucket; but teams and companies always work with remote repositories, and developing alone makes it so you never run into some of the problems git is great at solving, so it is important to understand how to work with those as well.
They are all platforms that provide internet hosting for version control using Git. They also provide further tools for software development management like source code management, access management, bug tracking, feature requests, task management, continuous integration and documentation hosting, to name a few.
They let you upload code either publicly or on private repositories and integrate with git to use its many benefits.
git config --list
Once you have the repository url you clone it (which will download its main/master branch) with:
git clone <repository-url>
This will create a folder with the repository name wherever you are. If you want to specify a path or a folder name, simply add it as a argument:
git clone <repository-url> /path/to/git_folder
Go to the directory with the project code (or an empty directory to start from zero) and run:
git init
This will create a new project where all files and subfolders are
git remote set-url origin https://github.com/Cygnus-Software/intro-git.git
Note: The remote url is generally the https repository url with a .git
at the end
git status
git commit -m "Tittle commit example" -m "Commit description"
git show <tag_commit>
git add
git branch <name_branch>
git checkout <name_branch>
git log
git log -p <file>
git diff
git diff --staged
git reset --hard
git tag <tag-name>
[user@Cygnus Cygnus_intro_git]$ git push origin develop
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access 'https://github.com/Cygnus-Software/intro-git.git/': The requested URL returned error: 403
git config --global --unset credential.helper
Credits to Tomomi Imura
sudo apt install gitk
https://git-scm.com/download/gui/linux
Pair programming Live-Share