background preloader

Git

Facebook Twitter

Rename a git branch. Scott Prager : Clean your branch's history before commiting. You make a small change to the code, but it's incomplete; doesn't compile or fully implement the feature you want. You want to save your work and try something, but you don't want your history littered with small or incorrect commits. Commit anyway! You can squash a bunch of commits together to make your log more brief. When you're done with the feature, run $ git rebase -i <master/develop/other> The -i stands for interactive and prompts the fallowing screen: I have made a small repository with 4 commits, however the first isn't shown since i'm rebasing onto it. Pick 9977ead Commit 2+1/2squash e1f203f Commit 2+2/2reword 1a07d53 Commit 3 squash tells git to combine the commit with the one above it. After saving and exiting the editor, git will automatically squash the commits and let you edit the message. # This is a combination of 2 commits.# The first commit's message is: Commit 2+1/2 # This is the 2nd commit message: Commit 2+2/2.

Top 10 Git Tutorials for Beginners. Git Immersion - Brought to you by EdgeCase. Book.