#at terminal
mkdir demo-merge
cd demo-merge/
ls
echo "hello DevOps" > index.html
git add -A
git init
git add -A
git commit -m "First Commit"
git branch
#change branch name to main
git branch -m main
git branch
git remote add origin <HTTPS URL>
git remote -v
git push -u origin main
#Now do the setting for Push files using SSH key
#Remove HTTPS URL
git remote remove origin
git remote -v
#ssh push and pull
ssh-keygen
#add password if necessary
|/home/ubuntu/.ssh/id_rsa
|/home/ubuntu/.ssh/id_rsa.pub
#share .pub key with git-hub
Github.com⇒Settings⇒SSH and GPG keys⇒New SSH key
Title
#lab_sys
Key
#Copy /home/ubuntu/.ssh/id_rsa.pub key and paste
Add SSH key
confirm access
git remote add origin <SSH URL>
git remote -v
git push -u origin main
#yes ask for the first time
#verify the push remote
#merging example
git checkout -b JIRA
echo "adding new feature" > view.java
git add *
git commit -m "done JIRA"
git push -u origin JIRA
git branch
* JIRA
develop
main
ls
demo.java index.html view.java
git checkout develop
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
ls
demo.java index.html
#to merge JIRA branch to develop switch to develop branch
git merge JIRA
Updating b50ca2a..4a62f5e
Fast-forward
view.java | 1 +
1 file changed, 1 insertion(+)
create mode 100644 view.java
ls
demo.java index.html view.java
git push -u origin develop
#verify the push in Github remote, develop branch
No comments:
Post a Comment