Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions commands.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,63 @@
git remote -v
# Show remote branch
# git remote -v

git branch -a
# Show all remote branches.
# git branch -a


git checkout -b develop1 main
git push --set-upstream origin develop1
# Create a new branch from existing branch.
# git checkout -b develop1 main
# git push --set-upstream origin develop1 # added to remote branch name
# git pull origin main # update from existing branch ( main )

# Create develop2 branch
git checkout -b develop2 main
git push --set-upstream origin develop2
git pull origin main
# git checkout -b develop2 main
# git push --set-upstream origin develop2
# git pull origin main


added to fix bug in hotfix.
# Merge the current branch (develop1) from another branch ( develop 2)
# git checkout develop1 ( current branch)
# git merge --no-ff develop2 ( other branch )
# git push ( to commit )

# To switch or work on other branch.
# git checkout develop1
# git switch develop1


# delete branch locally
# git branch -d localBranchName

# To delete branch remotely
# git push origin --delete remoteBranchName

# Git show different from branches
# git show develop1:commands.txt
# git show main:commands.txt
# https://stackoverflow.com/questions/10039747/how-to-view-file-diff-in-git-before-commit

# To edit global config
# git config --global --edit


# To show list of ref log
# git reflog
# git checkout -b "<branch-name>" "<head-ref-or-commit-sha>"
# https://colinmackay.scot/2021/12/10/how-to-undelete-a-branch-in-git/

# To show list of logs
# git show-ref --heads -s
# git branch -v --all
# https://stackoverflow.com/questions/8201765/how-to-get-list-of-branch-heads-in-git


# Git to change editor
# git config --global core.editor "vim"
# https://stackoverflow.com/questions/2596805/how-do-i-make-git-use-the-editor-of-my-choice-for-editing-commit-messages


#added to fix bug in hotfix.

# How to Undelete a Branch in Git
# git reflog
Expand Down
62 changes: 62 additions & 0 deletions tmp/links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
git fetch origin

git merge --no-ff develop2

git checkout develop1


To merge develop1 to main
git checkout main
git merge --no-ff develop1
git push


To create a new branch from existing branch
git checkout -b develop2 main



https://stackoverflow.com/questions/8201765/how-to-get-list-of-branch-heads-in-git
git show-ref --heads -s
git branch -v --all



# To switch other branch
git checkout develop1
or
git switch develop1


// delete branch locally
git branch -d localBranchName

// delete branch remotely
git push origin --delete remoteBranchName



# Git show different from branches
git show develop1:commands.txt
git show main:commands.txt
# https://stackoverflow.com/questions/10039747/how-to-view-file-diff-in-git-before-commit

git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> develop3


git branch -d hotfix
warning: deleting branch 'hotfix' that has been merged to
'refs/remotes/origin/hotfix', but not yet merged to HEAD
Deleted branch hotfix (was f64b708).


git push --set-upstream origin develop1