Topics Discussed:
- Version Control
- Github
- GIT commands
- Connecting Remote Repository
- Add
- Commit
- Pull
- Push
- Pull Request
- Merge
- Clone
- Branching in Git
- Pushing Projects to Github through Git
Git and Github
Git is a version control system that lets you manage and keep track of your source code history.
Github is a cloud based hosting service that let you manage Git repos
Basic Commands
• init – git-init – Create an empty Git repository or reinitialize an existing one
• status – git-status – Show the working tree status
• add – git-add – Add file contents to the index
• commit – git-commit – Record changes to the repository
• diff – git-diff – Show changes between commits, commit and working tree, etc
• restore – git-restore – Restore working tree files
•log – git-log – Show commit logs
Repo Operations
• remote – git-remote – Manage set of tracked repositories
• fetch – git-fetch – Download objects and refs from another repository
• push – git-push – Update remote refs along with associated objects
• pull – git-pull – Fetch from and integrate with another repository or a local branch
• branch – git-init – Create an empty Git repository or reinitialize an existing one
• switch – git-add – Add file contents to the index
• merge – git-merge – Join two or more development histories together
Branches
We can create as many branches. It mainly helps when there are multiple people working on a single project. Once everyone finishes working on their part we can check and merge each branch to a single main branch.(Considering main as the default branch). Merging means combining the codes written by other developers, which will be another branch.
Cherry-pick
It’s not a common git command. We use it to commit a particular commit to another commit. It’s also useful for undoing changes.
Merge vs Rebase
• Both solve the same problem.
• Merging as mentioned earlier it branches other branches and all the new changes will be in the main branch. Here the conflicts can be easily edited.
• Rebase is also doing the same where we can combine one branch with another branch.
• Here the commit history will be written, so it will be difficult when any conflicts come.