Hello Readers! welcome to this Git series of tutorials.
i’ll divide this series into different topics, so please hang in there.
For the starting i’ll start with basics!
What is a GIT?
Git is a version Control Software which is used to maintain change history of a codebase.
What is a GitHub?
GitHub is a online website which is used to store all these git commit histories.
How to install Git?
To install git on linux host we can use these following commands.
Note: Please refer to the official website if case of any errors!!
sudo apt install git-all
How to confirm successful installation of the Git?
to ensure git is available on the local machine, we can check it’s version by using the command!
How to initialize a Git repository on the local machine!!?
to instalize a git repository on the local machine.
Step 1 : navigate to the given directory
Step 2 : initialize the git repository
How to ignore certain files in git?
sometimes there are certain files which we dont want to upload on remote repository. to make this happen, we need to add the name of that file into .gitignore file
git add .gitignore
git commit -m “Git ignore file added”
How to manage Git branches
How to create a new branch?
branches contains sequence of commits in git.
we can create or delete as much as branch as we required.
To create new branch
git branch <branch-name>
# this command will create a new branch and switch to that branch
git checkout -b <branch-name>
How to rename a branch
to rename a branch in git, use the given command!
git checkout <branch-name>
# second use the following command to change the branch name
git branch -m <old-name> <new-name>
How to delete a branch
to delete a branch in git we use.
How to watch the commit history
to watch the commit history we have git log command