Skip to content

siddik95/git_version_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Version control with Git and GitHub

Version control is a process that tracks changes made to any file or program to fix a bug or make continuous improvements. Version control is done locally with git with a local repository, while a remote repository is hosted online in GitHub, GitLab, or Bitbucket.

Git installation

The installation of Git is fairly straightforward. Go to Git, then download and install the version suitable for your operating system.

Creating a profile in GitHub

You can create a profile on GitHub, GitLab, or Bitbucket. GitHub is the most popular one. While GitHub is not open-source, GitLab and Bitbucket are. I prefer GitHub, but you are open to choosing any of them. Go to GitHub and create an account.

Check if Git is properly installed

If you are using Windows, you can search for Git Bash in the Windows Start menu, or alternatively, right-click on any folder of your choice and select 'Open Git Bash here' to open a Git Bash shell. Remember that opening Git Bash shell from a folder would consider that folder as the current directory. After opening the Git shell, let's verify that Git is correctly installed by running a few lines of code.

 $git --version

Running this command returns 'git version 2.44.0.windows.1' for me. Probably yours should be something similar, depending on the version and operating system on which you have installed Git.

A few helpful commands to know

Now, considering that Git is correctly installed. The first command one should learn is how to get help when necessary.

$git help commit

Will return in detail help for the command commit. Optionally, one could get concise help in the shell window itself by typing.

$git commit -h

If you want to print your current working directory. You can write this command to print working directory.

$pwd

To view existing files in the working directory, you can go ahead and execute the first command to list the files in your current directory. Optionally, you can add an alias to see all files, including hidden files.

$ls
$ ls -laF

To change the current directory, see the commands below.

$cd <PATH TO DESTINATION FOLDER>
$cd .. #will move backward one step to the previous folder
$cd #will take you to the home directory
$cd <FOLDER> #folder then shown in the list directory command, will take you to that directory

Configure your Git

Probably, if you are a first-time user, you have not yet configured Git. Running this command would show your name if you have already done so.

$git config user.name

If it does not display your name, you can set your user name and email address by running these commands in Git shell. Use the email address that you used to create your GitHub account.

$git config --global user.name "YOUR NAME"
$git config --global user.email "YOUR EMAIL"

About

This repo contains some contents from git version control course

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published