Git: Difference between revisions
Jump to navigation
Jump to search
Line 68: | Line 68: | ||
'''discard changes''' | '''discard changes''' | ||
git checkout master -f | git checkout master -f | ||
'''delete and recreate''' | |||
git branch -d staging | |||
git branch -D staging | |||
git fetch origin staging | |||
git checkout -b staging origin/staging | |||
git merge develop | |||
'''git stashing''' | '''git stashing''' | ||
git stash; git checkout -b new_branch; git stash pop | git stash; git checkout -b new_branch; git stash pop | ||
git add .; git commit -m "new feature added"; git push | git add .; git commit -m "new feature added"; git push | ||
git remote -v;mv src/main/resources/application.properties ..;cd .. | |||
mv ../application.properties src/main/resources/ | |||
'''rebase vs merge''' | '''rebase vs merge''' |
Revision as of 05:36, 23 June 2021
git config --global user.name "Full Name" git config --global user.email "[email protected]" undo assume unchanged or assume unchanged git update-index --no-assume-unchanged src/main/resources/application.properties git update-index --assume-unchanged src/main/resources/application.properties list of files assume unchanged git ls-files -v|grep '^h'
Git Ignore
out/ *.iml *.ipr *.iws .idea/* cmake-build-*/ .idea_modules/ fabric.properties crashlytics.properties atlassian-ide-plugin.xml crashlytics-build.properties com_crashlytics_export_strings.xml
clear metadata rm -rf */out */*.iml */*.ipr */*.iws */.idea */cmake-build-* */.idea_modules
Git Stash
git stash apply stash@{index} git stash drop stash@{index} git stash pop stash@{index} git stash clear git stash list |
git apply --3way ~/.chorke/tmp/academia/patch/v1.0.00.patch git apply ~/.chorke/tmp/academia/patch/v1.0.00.patch git diff > ~/.chorke/tmp/academia/patch/v1.0.00.patch git stash apply stash^{/stash_v1.0.00} git stash push -m stash_v1.0.00 |
Git Tag
annotated tag git tag -a v1.5_initial_setup -m 'initial setup' git tag -a v1.5_initial_setup
lightweight tag git tag v1.5_initial_setup
Git Branch
create and checkout a new branch git checkout -b new_branch_name base_branch_name git checkout -b new_branch_name
renaming and delete branch git branch -m old_branch_name new_branch_name git branch -D branch_to_delete_without_merge_status git branch -d branch_to_delete git push origin --delete branch_to_delete
Knowledge
discard changes git checkout master -f
delete and recreate git branch -d staging git branch -D staging git fetch origin staging git checkout -b staging origin/staging git merge develop git stashing git stash; git checkout -b new_branch; git stash pop git add .; git commit -m "new feature added"; git push
git remote -v;mv src/main/resources/application.properties ..;cd .. mv ../application.properties src/main/resources/ rebase vs merge git rebase master #all the updated commits of master will be available in the feature branch git merge --squash feature #all the feature commits replaced by a new commit in the master git commit -m 'feature merged with master branch'