My Git experience
need homebrew
https://brew.sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
install gitflow
https://github.com/nvie/gitflow/wiki/Mac-OS-X
$ brew install git-flow
initialize gitflow
git flow init
this will ask to provide release and development branches. this means you need to maintain two different main branches to development and release. If you already created branches in origin, bring them in to local by
git checkout origin/branchname
this will automatically switch you to that branch.
then do required things once tyoe git flow init.
init Initialize a new git repo with support for the branching model.
feature Manage your feature branches.
release Manage your release branches.
hotfix Manage your hotfix branches.
support Manage your support branches.
version Shows version information.
git flow cheat sheet
https://danielkummer.github.io/git-flow-cheatsheet/
start new feature
git flow feature start feature_name
commit changes to feature branch
add files
git add .
commit
git commit -m "message"
finish feature
git flow feature finish feature_name
this will
Merges MYFEATURE into 'develop'
Removes the feature branch
Switches back to 'develop' branch
push local developemnt to origin
you should be in local development branch
git push
cannot use branch name as release due to create releases
git flow release start
these branches create under release . so no more release branches there
/////////////////
delete branch
git branch -d branch_name
delete remote branch
*** in Origin there is a master branch, which means this branch is the main branch. other all branches merege with this. you cannot delete this master branch.
$ git push -d origin <branch_name>
deleted orign branch sync with local
git fetch -p origin
*** in Origin there is a master branch, which means this branch is the main branch. other all branches merege with this. you cannot delete this master branch.
Tagging
add tag
git tag tagname
push tag to origin
git push origin tag_name
or
git push --tags
merge conflicts
git mergetool
this will ask switch merge tool to open.
press enter and merge conficts and commit and push if works fine
merge branches
merge dev changes to master
in master
git merge develop
see previous commit changes
git show
see changes before commit
git diff
changes of a file
git diff filename.extension
difference between two branches
git diff branch_1..branch_2
use two dots between two branch names
reset
Reverting The Working Copy to an Older Commit
git reset commit_id (56e05fced )
git reset commit_id f9be0cde2e091368b8e3241a0e8d0a55bd6fa7a3
Reverting Working Copy to Most Recent Commit
git reset --hard HEAD
remove untracked files
git clean -f -d
view history
git log
discard changes
git stash
rename remote branch
$ git branch new-branch-name origin/old-branch-name
$ git push origin --set-upstream new-branch-name (remember to change main branch in remote before this command)
$ git push origin :old-branch-name
remote deleted branch show in local. to delete it from local use
git remote prune origin
create gitignore file in mac
opent terminal
touch .gitignore
see ignore files
git status --ignored
To stop tracking a file that is currently tracked, use git rm --cached. (these filese should mention in .gitignore file)
git rm --cached iPay.xcodeproj/project.xcworkspace/xcuserdata/Thushara.xcuserdatad/UserInterfaceState.xcuserstate
git rm --cached .DS_Store
stuck in merge conflicts when feature finish
best thing is to forcely checkout to other branch without commit existing merge.0712773696
git checkout -f feature/ft
////////////////////
git maintain in submodule
https://blog.shopsys.com/how-to-maintain-multiple-git-repositories-with-ease-61a5e17152e0
https://git-scm.com/book/en/v2/Git-Tools-Submodules
///////////////
teams with plan
--------------
with the free plan one team can handle only with 5 users.
https://confluence.atlassian.com/bitbucket/plans-and-billing-224395568.html
structure is
team
project
repository
team has members
reposiroty has owner (it can be a team or individual, for free plan 1 repository can use only 5 members (sum of team members and individuals))
project has repositories
at any time repo can transger to any project. many teams can access one repository.
/////////////////
No comments:
Post a Comment