Git & GitHub
Amrutha Koduri
Gen AI Engineer | LLMs | Generative AI | Fine-tuning & Deployment | Cloud AI | Azure | GPT, LLAMA, Mistral, Deepseek | AI Solutions for Education
Git is a version control tool (software) to track the changes in the source code.
GitHub is a web-based cloud service to host your source code(Git repositories). It is a centralized system. Git doesn’t require GitHub but GitHub requires Git.
Pushing & Pulling :
Push: The?git push?command is used to transfer or push the commit, which is made on a local branch in your computer to a remote repository like GitHub. The command used for pushing to GitHub is given below.
Syntax : git push 'remote_name' 'branch_name'
Pull: If you make a change in a repository, GIT PULL can allow others to view the changes. It is used to acknowledge the change that you've made to the repository that you're working on. Or also called a target repository.
Syntax : git pull 'remote_name' 'branch_name'
The?git pull?command is a combination of?git fetch?which fetches the recent commits in the local repository and?git merge, which will merge the branch from a remote to a local branch also 'remote_name' is the repository name and 'branch_name' is the name of the specific branch.
Initializing a new git repository :
The?git init?command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository.?
Syntax : git?init
1. A new repository from scratch
2. A new repository from an existing project
Use of git clone and how to use it :
Syntax : git?clone?<repo>?<directory>
Ignoring some files/folders from pushing :
What's a Branch :
Which branch should be used to keep deployment-ready code ?
Master branch is the branch in which all the changes eventually get merged back. It can be called as an official working version of your project. So, Master/Main Bracnch should be used to keep deployment-ready code.
How create a new branch called development from the main branch ?
$ git branch development
Checkout one more branch deployment from the previous branch
$ git checkout -b deployment
Push different data into both branches
In development branch:
In deployment branch:
Merge data from both branches to the main branch
How to resolve conflict with merge
What is rebase and how is it different from merge in git?