Git Managing branches – Part 2

https://github.com/******/ReactTheme.git
Default :

echo "# ReactTheme" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M master
git remote add origin https://github.com/*******/ReactTheme.git
git push -u origin master

Create Branch and Push

git init
git clone https://github.com/******/ReactTheme.git
git add .
git commit -m "Admin Template HTML Initial Commit"
git branch
git branch html
git checkout html
git remote add origin https://github.com/******/ReactTheme.git
git push -u origin html

https://www.git-tower.com/learn/git/commands/git-push

Merge Code

git add .
git commit -, "command"
git pull // then merge the code from IDE
merge code 
git add .
git commit -m "Error Constant And JWT Commit Merged AWS"
check : git pull
git push

How do I undo ‘git add’ before commit?
git add.
git status
git reset HEAD myfile.txt
git status

modified: myfile.txt // myfile.txt is unstaged now
Either : git reset or git reset

Create a branch in Git from another branch

$ git checkout -b myFeature dev

Creates MyFeature branch off dev. Do your work and then

$ git commit -am "Your message"

Now merge your changes to dev without a fast-forward

$ git checkout dev
$ git merge --no-ff myFeature

Now push changes to the server

$ git push origin dev
$ git push origin myFeature

git clone –single-branch –branch
git clone –single-branch –branch Start https://github.com/abc/bookmark.git

https://github.com/abc/bookmark.git

How to clone all remote branches in Git?

$ git clone git://example.com/myproject
$ cd myproject

$ git branch
* master

$ git branch -a
$ git checkout origin/experimental

$ git checkout experimental
$ git branch
* experimental
  master

git clone https://github.com/abc/bookmark.git

>git branch
* main

>git branch -a
* main
  remotes/origin/HEAD -> origin/main
  remotes/origin/Start
  remotes/origin/main

>git checkout Start
Switched to a new branch 'Start'
Branch 'Start' set up to track remote branch 'Start' from 'origin'.

>git branch
* Start
  main

>git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.

>git merge Start

git push origin FirstAPI

Delete Git Credentials

git credential-manager delete https://github.com

git config --list

git config user.name = "abc"
git config user.email= "abc@gmail.com"

GitBash SSH, key Configuration with GitHub in Windows

Warning: Permanently added the RSA host key for IP address ‘13.234.210.38’ to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Solution :

1. Now lets configure the ssh keys with git
2. If you succesfully configure the ssh keys with github then there is no need for you to enter the password eachtime you push..since it is a ssh connection.
3. ssh-keygen -t rsa [ssh-keygen -t ed25519 -C "prabakaran@xxx.in"]
4. Key generation done ... using above command
5. Now lets checkout our pub key ... to upload
6. [ cat ~/.ssh/id_rsa.pub ]
7. Public key (rsa key) generated to upload to github, this is the rsa key stored at user/..sh/location.. Lets upload it (copy the key)
8. Go to github.com -> personal settings - SSH and GPG keys- New SSH Kdys
9. Key added lets test the connection [ssh -T git@github.com]
10. Done please verify your username (github username)

GitBash SSH Configuration with GitHub in Windows

Leave a Reply

Your email address will not be published. Required fields are marked *