Related to the session conducted at Faculty of Information Technology, University of Moratuwa on 2021/09/11, focusing on basic git workflows for their level 2 software projects.
need Git. Merging branches 01 WHAT & WHY CLONING & FORKING BRANCHES MERGE & CONFLICTS OTHER USEFULL COMMANDS Q/A 02 03 04 05 06 Getting started by cloning and forking Branching out from a base repository Rebasing, undo commits & Stashing Conclusion Session progress References
the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.
system designed to handle everything from small to very large projects with speed and efficiency. Git is easy to learn and has a tiny footprint with lightning fast performance. GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management functionality of Git, plus its own features.
main working project A repository is a folder whose contents are tracked by git. It is also known as a repo, in simple terms. Clone Repository A clone is a copy of a repository or the action of copying a repository.
the current branch. You are literally “pushing” your changes onto the remote. Adding/saving the changes to the local repository HEAD Commit HEAD is a reference variable used to denote the most current commit of the repository in which you are working. When you add a new commit, HEAD will then become that new commit.
<new-branch> -- do your changes –- > git commit –am “message” > git push origin <new-branch> 1 2 3 4 clone your changes branch push ORIGIN LOCAL origin / main origin / my-feature local / main local / my-feature
<new-branch> -- do your changes –- > git commit –am “message” > git push origin <new-branch> 1 2 3 4 clone your changes branch push ORIGIN LOCAL origin / main origin / my-feature local / main local / my-feature
& LOCAL Over time, remote repository (origin) will diverge from your local copy (clone), due to it getting updated from the pull requests by other team members. So we need to update local main branch frequently, and also you might need branches created by others as well, so we need to get those too.
resolve conflicts + commit merge push ORIGIN LOCAL origin / main origin / my-feature local / main local / my-feature > git checkout main > git pull > git checkout my-feature > git merge main -- OR –- > git checkout my-feature > git rebase main
development and combine them into a single branch. MERGE MERGE VS REBASE REBASE Git rebase is yet another alternative to merging used to integrate another branch with the branch where you’re currently working, except it keeps a linear commit history.