git_notes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
git_notes [2021/01/07 16:11] – [show contents of a deleted file] raju | git_notes [2023/03/28 15:18] – [amend last commits] raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== workflow ===== | ||
+ | ==== Updating feature branch with the latest development branch ==== | ||
+ | tags | bring feature branch up to date with development branch | ||
+ | |||
+ | Situation 1: | ||
+ | * User 1 raised a merge request to merge feature1 to development branch | ||
+ | * Before the merge request is accepted, development branch is updated by User 2 | ||
+ | |||
+ | Situation 2: | ||
+ | * Say you forked from development branch a while ago to work on a feature and created a branch called " | ||
+ | * After a while, development branch might have progressed and may have new changes added to it. | ||
+ | |||
+ | Task: | ||
+ | * Bring the feature1 branch up to date with the latest development branch. | ||
+ | |||
+ | Solution: | ||
+ | |||
+ | Get the latest versions of development and feature branches in the local repository. | ||
+ | < | ||
+ | git checkout development | ||
+ | git pull | ||
+ | git checkout feature1 | ||
+ | git pull | ||
+ | </ | ||
+ | |||
+ | Merge development branch into the feature branch and resolve any conflicts that may arise. | ||
+ | < | ||
+ | git merge development | ||
+ | </ | ||
+ | Push the changes to the remote. | ||
+ | < | ||
+ | git push | ||
+ | </ | ||
+ | |||
+ | Note:- The "git merge development" | ||
+ | |||
+ | ===== Tasks ===== | ||
+ | ==== Initializing git for version control ==== | ||
+ | < | ||
+ | git config --global user.name " | ||
+ | git config --global user.email " | ||
+ | git config --global push.default matching | ||
+ | git config --global alias.co checkout | ||
+ | git init | ||
+ | </ | ||
+ | |||
+ | Ref:- https:// | ||
+ | |||
===== dummy ===== | ===== dummy ===== | ||
+ | ==== git resources ==== | ||
+ | * https:// | ||
+ | |||
+ | ==== stackoverflow answers I came across ==== | ||
+ | * ignore all directories with a specific name - https:// | ||
+ | |||
==== show which branch is linked to which remote branch ==== | ==== show which branch is linked to which remote branch ==== | ||
* https:// | * https:// | ||
Line 15: | Line 69: | ||
See also: | See also: | ||
* https:// | * https:// | ||
+ | |||
+ | ===== git grep commands ===== | ||
+ | ==== dokuwiki table syntax ==== | ||
+ | < | ||
+ | git grep -i --all-match -e ' | ||
+ | </ | ||
+ | |||
+ | ===== Commits related ===== | ||
+ | ==== amend last commits ===== | ||
+ | useful commands | ||
+ | < | ||
+ | export EDITOR=vim | ||
+ | git commit --amend --author=" | ||
+ | git config user.email " | ||
+ | |||
+ | git config --get-all --show-scope user.email | ||
+ | git config --get-all --show-origin user.email | ||
+ | </ | ||
+ | |||
+ | ===== Configuration related ===== | ||
+ | ==== configuration files ==== | ||
+ | * https:// | ||
+ | |||
+ | ===== git commands usage ===== | ||
+ | ==== git cherry-pick ==== | ||
+ | < | ||
+ | git cherry-pick < | ||
+ | </ | ||
+ | |||
+ | Ref:- | ||
+ | * https:// | ||
+ | * https:// | ||
===== frequently used ===== | ===== frequently used ===== | ||
Line 23: | Line 109: | ||
</ | </ | ||
- | ==== push related ==== | + | ==== pull related ==== |
+ | for git $\geq$ 2.23.0 | ||
+ | < | ||
+ | git -c advice.detachedHead=false pull --rebase --autostash -v origin | ||
+ | </ | ||
+ | |||
+ | for git $\leq$ 2.20.1 | ||
< | < | ||
git pull --rebase --autostash -v origin | git pull --rebase --autostash -v origin | ||
</ | </ | ||
+ | |||
+ | used in | https:// | ||
+ |
git_notes.txt · Last modified: 2023/05/05 14:55 by admin