Last active
September 27, 2015 07:28
-
-
Save davidvanvickle/1233877 to your computer and use it in GitHub Desktop.
GIT notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull to web host | |
git init | |
git remote add origin [email protected]:username/domain.git . | |
git pull origin master | |
http://nvie.com/posts/a-successful-git-branching-model/ | |
branches: | |
- master | |
- hotfix | |
- release | |
- develop | |
- feature | |
# push and pull all branches | |
git push --all | |
git pull --all | |
# always merge with --no-ff | |
# make a "feature" branch from "develop" | |
git checkout -b myfeature develop | |
git commit -a -m "new branch made" | |
# merge "feature" back into "develop" | |
git checkout develop | |
git merge --no-ff myfeature | |
git branch -d myfeature | |
git push origin develop | |
# merge "release" into "master" and tag it | |
git checkout master | |
git merge --no-ff release-1.2 | |
git tag -a -m "yay a tag" 1.2 | |
# merge "release" changes back into "develop" | |
git checkout develop | |
git merge --no-ff release-1.2 | |
# remove "release" branch | |
git branch -d release-1.2 | |
## more | |
# delete remote branch | |
git push origin :remote-branch-to-delete | |
# undo | |
# if uncommitted | |
git reset --hard HEAD | |
# if Just one messed up file | |
git checkout HEAD hello.rb | |
# if Take back the last commit | |
git revert HEAD | |
# prior to github repo delete... remove local ref to remote | |
git remote rm origin | |
# remote info | |
git remote show origin | |
# branch list | |
git branch | |
# branch rename | |
git branch -m oldname newname | |
# tag list | |
git tag | |
Global setup: | |
Set up git | |
git config --global user.name "My Name" | |
git config --global user.email [email protected] | |
Next steps: | |
mkdir domain | |
cd domain | |
git init | |
touch README | |
git add README | |
git commit -m 'first commit' | |
git remote add origin [email protected]:username/domain.git | |
git push -u origin master | |
Existing Git Repo? | |
cd existing_git_repo | |
git remote add origin [email protected]:username/domain.git | |
git push -u origin master | |
Add deleted files | |
git add -u | |
Exclude files already commited | |
(first update .gitignore with preferred like: | |
* | |
!*.js | |
!*.css | |
!*.htm | |
!*.html | |
!*.asp | |
!*.php | |
_* | |
) | |
git rm -r --cached . | |
git add . | |
git commit -m "fixed untracked files" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment