Skip to main content
Home
Grace in Motion

Main navigation

  • Home
  • About
User account menu
  • Log in

Breadcrumb

  1. Home

Pro Git Chapter 3 notes

By admin, 4 May, 2012

git branch testing: new branch called testing
-v adds last commit
--merged shows branches merged into your currently checked out branch
--no-merged shows unmerged branches

Can't git branch -d (delete) unmerged branch without -D confirmation

git checkout testing: switches to that branch
git checkout master: switch back
git checkout -b iss53: create branch and switch to it

work needs to be committed before switching

to merge: go to master (or target branch) then merge branch into that branch
git checkout master
git merge hotfix
git branch -d hotfix: delete branch now that it is merged
(yep, merging doesn't merge everything, you still have the branch)

HEAD is like a pointer showing where you are on the commit/branch path

Merge conflicts:

GIT pauses; you can check status to see files needing resolution.

You go to the files and see:


Checked out code
========
Merging in code
>>>>>>>

Choose which you want or replace all. Add, commit and try again.
mergetool is graphical helper.

Remote Branches

If you clone, git calls this origin, points to master branch. Hence name: origin/master. This is a remote branch.
You also get your own master (local branch) to work off of.
Development can move ahead on the remote branch. To sync:
git fetch origin gets branches, but doesn't merge them. You do that:
git merge remote/branch (ex. origin/serverfix)
or, if you just want a working copy of the remote branch (they are read only)
git checkout -b alias remote/branch creates a new branch and moves into it. This new branch is a tracking branch, which allows you to push and pull to the remote branch. You can set this up for any branch.

git remote add alias_name path/to/repo.git adds a remote
git push remote remote_branch
git push origin :branch_to_delete deletes a remote branch

Rebasing

This is similar to merging but does it via a series of commits from the common ancestor of the branch, rather than a single code update. Allows for multiple branches to be committed in series. Replays commits.
This allows for skipping over a branch still in development.
git rebase --onto target_branch_to_replay_commits_to branch_to_skip_over (common ancestor) branch_to_replay_commits_from

Do not rebase commits that you have pushed to a public repository.

 

Recent content

  • Titles and GSD
    1 month ago
  • Your support team is your most important user
    2 months 1 week ago
  • Talking about culture
    1 year 8 months ago
  • Recession Proofing
    2 years 4 months ago
  • Relearning Drupal, Preface
    2 years 4 months ago
  • 2023 Reset
    2 years 4 months ago
  • Antipatterns in Saas, cont'd
    2 years 4 months ago
  • Drupal 10 is not super easy
    2 years 5 months ago
  • Being a Q AND A Man
    2 years 8 months ago
  • Facing
    2 years 8 months ago
RSS feed
Powered by Drupal