Skip to content

Commit

Permalink
Updated git resources
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyakobovitch authored Jul 29, 2018
1 parent 910f1fe commit a86cf88
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions git_resources.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
https://www.toptal.com/git/tips-and-practices
https://www.atlassian.com/git/tutorials/what-is-version-control
### Git is an effective technology for maintaining code with revisions across all operating systems and technology environments. This resource serves to offer a high-level cheat sheet on frequent and effective use cases for the Git version control system.

git config --global user.name "David Yako"
git config --global user.email "[email protected]"
Expand Down Expand Up @@ -34,6 +33,10 @@ git diff #--color-words #see changes before staging
git diff --staged
git status
3. git commit -m "comment goes here" #commits the track change to log
### Edit the Commit Message
git commit --amend # start $EDITOR to edit the message
git commit --amend -m "New message" # set the new message directly

git status
git log --patch cats.txt #Shows log and diff together
4. git push origin master
Expand Down Expand Up @@ -68,7 +71,6 @@ git config --global https.proxy http://user:[email protected]

# Merge conflicts between branches


git checkout feature
git rebase -i master

Expand Down Expand Up @@ -121,6 +123,38 @@ git add -A #git knows to remove it
git commit --amend -v #to edit commit message
git rebase --onto HEAD [commitID] master


git rebase --continue
git rebase --skip

git rebase --interactive
# if you didn't specify any tracking information for this branch
# you will have to add upstream and remote branch information:
git rebase --interactive origin branch

### Additional Git Options
git reset HEAD~2 # undo last two commits, keep changes
git reset --hard HEAD~2 # undo last two commits, discard changes

git checkout -- Gemfile # reset specified path

git reset filename # or git remove --cached filename
echo filename >> .gitingore # add it to .gitignore to avoid re-adding it

git add forgotten_file
git commit --amend

### Reverting Pushed Commits
git revert c761f5c # reverts the commit with the specified id
git revert HEAD^ # reverts the second to last commit
git revert develop~4..develop~2 # reverts a whole range of commits

### undo the last commit, but don't create a revert commit
git revert -n HEAD

### Avoid Repeated Merge conflicts
git config --global rerere.enabled true

### References:
- https://www.toptal.com/git/tips-and-practices
- https://www.atlassian.com/git/tutorials/what-is-version-control
- https://gist.github.com/citizen428/16fb925fcca59ddfb652c7cb22809018

0 comments on commit a86cf88

Please sign in to comment.