First download the repository and then list branches
Step 1 : Run bellow command to set console configurations and change your directory to download location
Command : git config --global user.email "you@example.com"
Command : git config --global user.name "Your Name"
Command : cd ~/Desktop
Step 2 : Enter git command. Make sure to put .git at the end of your repository
Command : git clone https://your-git-server/your-project/testrepository.git
Output : Cloning into 'testrepository'...
Step 3 : Enter username and password of your git account
Step 4 : Check console output
remote: Enumerating objects: 273, done.
remote: Counting objects: 100% (273/273), done.
remote: Compressing objects: 100% (120/120), done.
remote: Total 273 (delta 79), reused 233 (delta 60)
Receiving objects: 100% (273/273), 89.99 KiB | 415.00 KiB/s, done.
Resolving deltas: 100% (79/79), done.
Step 5 : Check the download directory
Step 6 : Change your directory to downloaded repository location
Command : cd testrepository
Step 7 : List branches
Command : git branch -al
Step 8 : Check output for if branches are available
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/testrepository
Updating Master Branch
Step 1: Run bellow command to set console configurations and change directory to the downloaded directory
Command : git config --global user.email "you@example.com"
Command : git config --global user.name "Your Name"
Command : cd ~/Desktop/testrepository
Step 2 : Change some file contents, add or delete files.
Step 3: Update changes by bellow command.
Command : git add .
Step 4: Commit the code with proper comment.
Command : git commit -m "Updated properties"
Step 5: Check console output
[master 5ca1aa2] Updated properties
1 file changed, 1 deletion(-)
Step 6: Push changes to remote repository
Command : git push -u origin
Step 7: Enter username and password and check console output
Username :
Password :
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 322 bytes | 322.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://your-git-server/your-project/testrepository.git
371609a..5ca1aa2 master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Cloning a branch
Step 1: Run bellow command to set console configurations and change directory to the downloaded directory
Command : git config --global user.email "you@example.com"
Command : git config --global user.name "Your Name"
Command : cd ~/Desktop
Step 2 : Clone the branch
Command : git clone -b
Example : git clone -b testbarnchname https://your-git-server/your-project/testrepository.git
Step 3: Enter username and password of your git repository
Cloning into 'testbranch'...
Username :
Password :
Step 4: Check output
remote: Enumerating objects: 290, done.
remote: Counting objects: 100% (290/290), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 290 (delta 71), reused 227 (delta 53)
Receiving objects: 100% (290/290), 87.84 KiB | 1022.00 KiB/s, done.
Resolving deltas: 100% (71/71), done.
Updating a branch
Step 1: Run bellow command to set console configurations and change directory to the downloaded directory
Command : git config --global user.email "you@example.com"
Command : git config --global user.name "Your Name"
Command : cd ~/Desktop/testbranch
Step 2 : Change some file contents, add or delete files.
Step 3: Update changes by bellow command.
Command : git add .
Step 4: Commit the code with proper comment.
Command : git commit -m "Updated properties"
Step 5: Check console output
[master 5ca1aa2] Updated properties
1 file changed, 1 deletion(-)
Step 6: Push changes to remote repository
Command : git push -u origin testbarnchname
Step 7: Enter username and password and check console output
Username :
Password :
Step 8 : Check console output
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 319 bytes | 319.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote:
remote: To create a merge request for testbranch, visit:
remote:
To https://your-git-server/your-project/testrepository.git
1524205..cd1eb7b testbranch -> testbranch
Branch 'testbranch' set up to track remote branch 'testbranch' from 'origin'.
No comments:
Post a Comment