Thom Parkin
ISBN: 978-1-78355-413-3 from Packt Publishing
Due to changes in Git 2.x the behavior with respect to remote-tracking branches (and 'fetch' or 'pull') is different. Further complicating matters, all the top search results point to StackOverflow pages that were written prior to this change.
Now, a git clone command will only bring in the master branch. In order to properly setup the remote-tracking-branches (when the cloned repository has other branches) you need to follow the advice in this StackOverflow topic (about halfway down the page);
- Use this bash command to create local branches for all remote-tracking ones
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; done
- Use
'git fetch --allorgit pull --all
This has worked for me reliably many times.
I recommend Git Workflows for Pros: A Good Git Guide by Joe James for an in-depth exposition of various Git Workflow options.
Add this to the ~/.bashrc file on your computer for the customized command prompt that shows your current 'git' branch:
[ -z "$PS1" ] && return
function parse_git_dirty
{
git diff --no-ext-diff --quiet --exit-code &> /dev/null || echo "*"
}
function parse_git_branch
{
git branch --no-color >2 /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/"
}
export CLICOLOR=1
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$(parse_git_branch)\$ "
This terrific article by Chris Beams contains lots of good advice. I particularly like the idea of finishing the sentence "If applied, this commit will...". That is what I intended in Mastering Git when I stated the message should advise "the developer of the future" (usually me) how the project will change if this commit is checked out.
The smart people at GitHub have provided this compact reference for Undo almost anything in git.
Legit is a complementary command-line interface for Git, optimized for workflow simplicity. Fork it on GitHub and contribute to the project!
First Aid Git is a very useful resource, carefully curated list of common questions about git. Much better than the SHOTGUN approach of StackOverflow.
The wonderful people at GitHub have written this great short explanation of th git bisect command
'Mastering Git' was written entirely with BeeGit, and as a valued student YOU have direct access to a special promotional offer. If you subscribe to Beegit's terrific service and enter the Coupon Code "MasteringGit", you will be rewarded.
The Git Parable by Tom Preston-Werner is a GREAT way to gain a grasp of the fundamental philosophy of Git.
© Packt Publishing 2015-2018 -- all rights reserved