Welcome to the Git Workshop! This workshop is designed to introduce you to Git, a distributed version control system that helps manage and track changes in your code.
- Introduction to Git
- Installation
- Getting Started with Git
- Basic Git Commands
- Branching and Merging
- Working with Remote Repositories
- Advanced Git Commands
- Best Practices
- Resources
- Q&A
Git is a distributed version control system created by Linus Torvalds in 2005. It allows multiple developers to work on a project simultaneously, track changes, and collaborate effectively. Git is widely used in the software development industry and is a fundamental tool for version control.
Download the Git installer from the official Git website and follow the installation instructions.
Install Git using Homebrew:
brew install git
Install Git using the package manager:
sudo apt-get install git # Debian/Ubuntu
sudo yum install git # Fedora
To create a new Git repository:
git init
To clone an existing repository:
git clone <repository-url>
To check the status of your working directory and staging area:
git status
To add files to the staging area:
git add <file-name>
To add all files:
git add .
To commit changes with a message:
git commit -m "Your commit message"
To push changes to the remote repository:
git push origin <branch-name>
To pull changes from the remote repository:
git pull origin <branch-name>
To create a new branch:
git branch <branch-name>
To switch to a different branch:
git checkout <branch-name>
To merge a branch into the current branch:
git merge <branch-name>
To add a remote repository:
git remote add origin <remote-url>
To fetch changes from the remote repository:
git fetch origin
To pull changes from the remote repository:
git pull origin <branch-name>
To push changes to the remote repository:
git push origin <branch-name>
To stash changes:
git stash
To apply stashed changes:
git stash apply
To rebase your current branch onto another branch:
git rebase <branch-name>
To pickup, squash, or reset your commmits :
git rebase HEAD~<No of Commits> -i
## force push
git push --force
- Commit often with meaningful messages.
- Use branches for new features or bug fixes.
- Keep your branch history clean by rebasing and squashing commits.
- Regularly push your changes to remote repositories.
- Review code and collaborate using pull requests.
Feel free to ask any questions during the workshop. Happy coding!