Difference between revisions of "Linux command: git"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) |
||
| Line 8: | Line 8: | ||
== Branching == | == Branching == | ||
| − | git checkout <branch_name> | + | git checkout -b <branch_name> |
git merge | git merge | ||
| + | |||
| + | === git Successful Feature Branching Workflow === | ||
| + | Onece you have cloned the master repository: | ||
| + | * Create a branch for each feature | ||
| + | * Merge branches with --no-ff | ||
| + | |||
| + | git checkout -b <branch_name> | ||
| + | Write your new code | ||
| + | Switch to the master branch to merge | ||
| + | git merge --no-ff <brach_to_merge_name> | ||
== Undo last changes == | == Undo last changes == | ||
Revision as of 19:13, 18 July 2015
Clone
git clone <repository_path>
add/commit/push
git add . git add -A git commit -m "Message of commit" git push origin master
Branching
git checkout -b <branch_name> git merge
git Successful Feature Branching Workflow
Onece you have cloned the master repository:
- Create a branch for each feature
- Merge branches with --no-ff
git checkout -b <branch_name>
Write your new code Switch to the master branch to merge
git merge --no-ff <brach_to_merge_name>
Undo last changes
git checkout -- .
add remote
git remote add <repository_name> <repository_path>
list remote
git remote -v
Modify remote url
git remote set-url origin <new url>/OTHERREPOSITORY.git
remove remote
git rm <repository_name>
pull/push
git push <repository_name> git pull <repository_name>
Add .gitignore
Add the file to the git folder To stop following and delete the files that were allready being tracked:
git rm -r --cached . git add . git commit -m ".gitignore now working"
- To undo git rm --cached filename use: git add filename
Cheat Sheet
http://wiki.herrerosolis.com/images/4/46/Git-cheat-sheet.pdf