This is the second installment of Git for grad students, a practical guide on Git branches translated and adapted into Spanish so you can learn to work safely and collaboratively with version control
What problem do branches solve in Git? In a team, sometimes everyone needs to edit the same shared file as if it were a Google Slides presentation. The solution of copying the file to work safely is equivalent in Git to creating a new branch. Each person works on their isolated copy, requests review if necessary, and only when everything is approved are the changes integrated into the main file
Main advantages Creating a copy is equivalent to creating a new branch. Combining several copies into a single file is merging branches. If two people change exactly the same line, a conflict appears that must be resolved manually
Basic workflow Imagine the main branch is called master and represents the original shared file. When you are assigned a task, follow these steps: create a new branch, work on that branch, add the changes to the staging area and create a commit, merge the working branch back into master
Essential commands for the local workflow: see the current branch using git branch, create and switch to a new branch using git checkout -b branch_name, add files to the staging area with git add file_name, create a commit with git commit -m message, return to master with git checkout master, merge a branch into the current branch with git merge branch_name
Practical example Step by step: create a branch called feature/bye_there with git checkout -b feature/bye_there, edit index.js to add a new line with a console log, for example console.log(bye there), then git add index.js and git commit -m [feature] add bye there. To integrate the changes, return to master with git checkout master and merge with git merge feature/bye_there
Conflicts and how to resolve them Suppose two colleagues work simultaneously and both create new branches from master. In one branch, main.js is added with console.log(1), and in the other, main.js with console.log(2). If the branch with console.log(1) is merged first and then we try to merge the other branch, Git will detect that the same line was modified differently and will mark a conflict. Git inserts markers in the file to indicate the current version, the separator, and the incoming version. To resolve the conflict, open main.js, decide the correct version or combine both lines leaving console.log(1) followed by console.log(2), save the file, add the changes with git add main.js and finalize the merge with git commit -m Merge branch feature/print_2
Why the conflict occurs Simple summary: Git tries to apply each set of changes to the current state. If two changes affect the same location in the same file, Git cannot decide automatically and asks for human intervention
Commands clarified from part 1 The command git checkout master is used to switch to the master branch and also to exit a previous view mode if you were checking an old commit using its hash. The command git switch -c branch_name creates and switches to a new branch from the current commit without losing history or needing destructive resets
Practical thinking exercise Imagine you work with a Photoshop file called cute-photo.psd and the client requests continuous changes. With Git you could version each step by creating branches for each proposal, for example feature/dramatic_lighting, feature/liquidfy, feature/hair_pink, feature/hair_blue, feature/eyes_bigger, and merge or revert according to the client's decision. To return to a previous state you can use git reset --hard commit_hash, although remember that reset is destructive if you do not have remote copies
Limitations in binary files Although Git can store versions of binary files such as psd or ai, conflict handling in binaries is not practical because it is not humans who can edit those bytes in a readable way. That is why in collaborative design, other workflows or specialized systems are often used
Quick summary of commands seen git branch to see branches, git checkout branch_name to switch branches, git checkout -b branch_name to create and switch to a branch, git merge branch_name to merge a branch into the current branch, and tips for resolving conflicts
Next chapter In part 3 we will see how to work with remote repositories such as GitHub or GitLab using git push, git pull, git clone and how to collaborate as a team with remote branches
About Q2BSTUDIO Q2BSTUDIO is a software development company specialized in custom applications and custom software. We offer comprehensive solutions for companies that want to leverage artificial intelligence and generate value with AI agents. Our services include advanced cybersecurity, aws and azure cloud services, implementation of business intelligence services and creation of dashboards with power bi. We develop custom applications that integrate artificial intelligence for companies to automate processes, improve decision-making and keep environments secure. We work on AI projects for companies, conversational AI agents and business intelligence solutions adapted to each client
Why choose Q2BSTUDIO Because of experience in software development, focus on security and deep knowledge of aws and azure cloud platforms, we deliver custom software projects that combine artificial intelligence, cybersecurity and analytics with power bi to turn data into decisions
If you need help implementing version control workflows, automating cloud deployments or integrating AI into your processes, contact Q2BSTUDIO and transform your idea into a scalable and secure solution





