• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

GitHub Bootcamp: Day 3 - Branching and Merging Like a Pro

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
Welcome to Day 3 of our GitHub series! Today we're diving into branching and merging—the secret sauce behind collaborative development. If GitHub was a movie, branches would be the plot twists, and merges would be the dramatic reunions. Let's get into it!

? What is a Branch?


A branch in Git is like a sandbox where you can work on changes without affecting the main (production) version of your code.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Imagine you're writing a novel. Your main branch is the final version, but you want to try out an alternate ending. Instead of rewriting everything, you create a branch called alternate-ending and work there. Genius, right?

? Creating a Branch


git branch feature-cool-button
? Switching to Your Branch


git checkout feature-cool-button

OR


git switch feature-cool-button

Now you're in your own bubble. Make changes, commit them, and live your best dev life.

✨ Merging: The Reunion Episode


Once you’re happy with your changes in a branch, it’s time to bring them back into the main branch. That’s merging.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



? First, Switch to Main


git checkout main
? Merge Your Branch


git merge feature-cool-button

Boom! Your changes are now part of the main storyline.

⚠ What About Merge Conflicts?


Sometimes Git gets confused if the same part of a file has been changed in both branches. It’ll raise a merge conflict and ask you to resolve it.

Don't panic.

  • Git will mark the conflicts in the file.
  • You decide which version to keep.
  • After editing, mark the conflict as resolved:

git add conflicted-file.js
git commit
? Pro Tips

  • Name your branches clearly: bugfix-login-issue, feature-dark-mode.
  • Always pull latest changes before you merge.
  • Use git log --graph to visualize branches.
  • Use git status to stay aware of what’s going on.
? Pull Requests: Collaborate the GitHub Way


If you're working with a team or contributing to open source, don’t just merge directly. Open a pull request on GitHub.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Why?

  • It allows others to review your code.
  • You can discuss changes before merging.
  • Ensures cleaner, safer code.
? Summary


Branching and merging are powerful tools for working independently without chaos. Master these, and you’re halfway to becoming a Git wizard.

Coming Up: Day 4 - GitHub Actions ✨


Next, we’ll explore how to automate workflows and save time with GitHub Actions. Get ready for some dev magic!

#GitHub #Git #VersionControl #GitTips #CodeCollaboration #OpenSource


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу