Photo by Matt Duncan on Unsplash
Web Developer Road Map part 2
Web Developer Road Map - [Git and GitHub]
Table of contents
Hello friends! having covered part one of the web development roadmap part 1, please find the attached link and let's proceed to part 2.
Git and GitHub
Git
According to Wikipedia Git is a distributed version control system: tracks changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems).
Git was originally authored by Linus Torvalds in 2005 for the development of the Linux kernel, with other kernel developers contributing to its initial development. Since 2005, Junio Hamano has been the core maintainer. As with most other distributed version control systems, and unlike most client-server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server. Git is free and open-source software distributed under the GPL-2.0-only license.
Git makes it possible for a software developer to work collaboratively with other software developers by merging, committing and pushing new changes to the project under development.
For one to start using git it has to be installed locally from https://git-scm.com/. When you visit the site select the appropriate git version according to your operating system. After downloading and installing git open your command terminal and run this command: git --version this displays the current git version on your machine.
Below is a list of major Git Commands:
git code. //Open vs code
git status //Show file status
git status -s //show short file status
git add <filename> //Add the particular file to the staging area
git add. //Add all the files to the staging area
git commit --amend //Add these changes to the last commit (will have to use vim editor)
git commit -m "message" //Commit the files in the staging area
git commit -am "message" //Will commit without adding the file to the staging area
git checkout --<filename> //will restore the file from the last commit
git checkout -f //All the files will be replaced with the last commit
git checkout -b <branch name> //Create a branch
git branch //To see the branches
git branch -d <branch name> //To delete a branch
git branch -v //will show the branch and its last commit
git branch --merged //will show the branches that are merged
git branch --no-merged //will show the branches that are not merged
git merge <branch name> //while in a branch you can merge another branch
git log //Show all the commits
git log -n //n can be replaced by any number "will show the last n commits"
git log -p //Will show a detailed description of the commits
git log -p -n //use of n is similar to described above
git log --stat //will show short detail of the commits
git log --stat -n //use of n is similar to described above
git log --since=n.days //commit of last n days/weeks/months "days can be replaced by weeks, months"
git rm --cached <filename> //will remove the file from the tracking area
git rm -rf //will uninitialized the current repository
git rm <filename> //will delete the file
git mv <Present filename> <The filename after the change> //to Rename the file
git clone <URL> //Cloning a repository in the current folder
git clone <URL> folder name //Cloning the repository in the given folder name (Folder will be created by itself)
git config --global alias. <new name> 'old command' //while creating an alias command for the given command
git remote //Show all the names of the remote repository
git remote -v //Show all the paths (fetch/push) of the remote repository
git remote add <name> url //Add a remote repository
git remote rm <name> //To remove a remote
git push <remote name> <branch name> //To push a branch to remote repository
git push <remote name> <branch name>:<branch name you want to have in the remote repository>
git reset HEAD //To move to a previous commit
More commands can be found here: https://git-scm.com/docs/git-log
Learning Materials:
GitHub
GitHub is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project. GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. GitHub lets developers upload their code using various GIt commands to a remote repository(folder) where other developers can collaborate remotely.
The following tutorial teaches important GitHub Essentials from creating and using a GitHub repository to opening and merging a pull request. https://docs.github.com/en/get-started/quickstart/hello-world
Additional Resources:
Weekly Podcast:
Quote of the week:
Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ― Martin Fowler
Until next week let's continue hacking!