Git for Programmers: Master Git for effective implementation of version control for your programming projects
- Length: 244 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2021-07-09
- ISBN-10: B0978TF66B
- ISBN-13: 9781801075732
- Sales Rank: #1137285 (See Top 100 Books)
Learn to track, branch, merge, and manage code revisions for real-world development scenarios
Key Features
- Master Git and understand the significance of version control
- Get to grips with Git’s typical workflows, advanced functions, and their implementations
- Understand important git commands to manage your repository
Book Description
Git is the most popular version control system in the world. It allows developers to keep up with frequent code changes in a project, ensures there are no code conflicts between the developers, and reverts to an older version of code when required.
Git for Programmers comprehensively equips you with actionable insights on advanced git concepts in an engaging and straightforward way. This book will help you gain expertise on git with many practical use cases as you progress through the chapters.
The book begins with a quick history of git and instructions on how to get it and install it, after which you’ll dive into the creation and cloning of your repository. As you progress through the book, you’ll explore Git places, branching, and GUIs.
Once you understand the fundamentals, you’ll learn how to handle merge conflicts, rebase, amend, interactive rebase, and use the log. You’ll also explore important Git commands for managing your repository. Finally, the book concludes with coverage of bisect, blame, and several other problem handling techniques.
By the end of this book, you’ll be able to use git with confidence; saving, sharing, and managing files as well as undoing mistakes and rewriting history.
What you will learn
- Create and clone repositories
- Understand the difference between local and remote repositories
- Use, manage, and merge branches back into the main branch
- Utilize tools to manage merge conflicts
- Manage commits on your local machine through interactive rebasing
- Use the log to gain control over all the data in your repository
Who This Book Is For
If you have basic understanding of git and want to strengthen your command over advanced techniques and navigate different functions, this book is for you.
Preface Who this book is for What this book covers To get the most out of this book Download the color images Conventions used Get in touch Share your thoughts Introduction About this book Version control About the code examples Just a brief history Tools for working with Git GitHub, et al. GUIs and the command line The command line Making the command line pretty Visual Studio 2019 Getting Visual Studio for free GitHub Desktop Getting Git Getting Git on Windows Getting Git on a Mac Getting Git on Linux Checking your version Configuring Git – the command line Configuring Git – Visual Studio Configuring Git – GitHub Desktop Summary Creating Your Repository Creating your repository Creating your repository on GitHub first Cloning to your computer – command line Cloning to your computer – visual studio Cloning to your computer – GitHub for Desktop Creating a project Git pull Pulling down using GitHub Desktop Pulling down to Visual Studio Push me, pull you Pushing to the server Downloading the changes at the command line Downloading the changes using GitHub Desktop Starting at the command line Pulling to GitHub Desktop Pulling to Visual Studio Commits – best practices How often should I commit? Keep your commit history clean A note on commit messages When the title isn't enough Summary Branching, Places, and GUIs Five places The work area The index/staging area Skipping the staging area Visual Studio GitHub Desktop Local and remote repositories The stash Branches Programmer 1 (CommandLine) and calculator Pushing the new branch Examining origin Adding commits to a branch The Book branch – Git within Visual Studio Committing with GitHub Desktop Status What's on origin? Adding more commits Examining your commits Summary Challenge Answer Merging, Pull Requests, and Handling Merge Conflicts Merging overview Book What's in that push? Visual Studio Details, details GitHub Desktop Push it already Visual Studio Merge conflicts Merging from the command line Fast forward True merge Avoiding conflicts Summary Challenge Answer Task #1: Set up a new repository and clone it to two different folders Task #2: Have one person populate the main branch with the beginnings of UtilityKnife, commit the changes, and push it Task #3: Each programmer creates a feature branch. Each programmer then puts the beginning of their feature into their branch, committing frequently (more frequently than you would in "real life") Sara and the Calculator Task #4: Merge the main branch into the feature branch frequently to ensure that if there are conflicts, you catch them early Task #5: John is building the temperature converter. Have him "borrow" code from the calculator. See if there are merge conflicts Rebasing, Amend, and Cherry-Picking Rebasing How Git does it Getting your head around it Rebase early and rebase often Rebase locally only Rebasing in practice Seeing the rebase at work Conflicts Amending Cherry-picking Visual Studio cherry-picking Summary Challenge Answer Creating a new repository on GitHub Creating two feature branches with fake programmers Frequent rebasing Amending a commit to add a file Amending a commit to change the message Cherry-picking one commit onto main Interactive Rebasing Interactive rebasing at work Creating our example Using interactive rebase to clean up your commits Summary Challenge Workflow, Notes, and Tags Standard workflow Mirroring your repo Replicating an existing repo Adding and showing notes Tags Pointing to a different tag Summary Challenge Aliases Aliases Summary Challenge Answer Using the Log Getting started with log The LogDemo program Visual Studio GitHub Desktop log at the command line Which files changed? What changed in each file? diff Visual Studio What changed in this file over time? Search Where are my commits? Summary Challenge Answer Create a new repository Add at least 6 commits Find the names of every file changed in each commit Find what changed in a given file over time Find all the files you committed in the past hour (or whatever time increment makes sense) Important Git Commands and Metadata Stash Clean Metadata Summary Challenge Answer Finding a Broken Commit: Bisect and Blame Blame Challenge Fixing Mistakes You wrote the wrong message in the last commit You forgot to add changed files from your last commit Problems with the order of commits or their messages You need to undo changes made in a commit You misnamed your branch You committed to the wrong branch You trashed a file in a previous commit You messed up the remote by pushing a broken branch Quiz Answers What do you do if you left out a changed file in the last commit? What do you do if you committed to the wrong branch? What do you do if you corrupted a file in a previous commit? What do you do if you need to undo changes made in a commit? What do you do if you trashed Master by pushing a broken branch? Next Steps Why subscribe? Other Books You May Enjoy Index
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Git for Programmers: Master Git for effective implementation of version control for your programming projects
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.