Set up Git from the Command-line
git clone "server url" //This will create a new local repository which is a clone of the server repository. Along with all its branches.
git init
git log
git diff
git status
git commit -m "first commit"
git commit -a -m "made some change"
git branch
git commit --amend //This will merge the new commit to the existing commit.
git checkout --<file name> //This will revert the changes we did in the file to the last commit state.
git config --global user.name "radha" //Changing the User Name
git config user.name //To Display the User NAME
git branch //list all branches
git config user.name //To Display the User NAME
git branch //list all branches
git branch test //new branch
git checkout test //switch branch
git checkout -b test //single cmd to do above 2 commands
git merge newBranch //wen ever ur merging have to go to current branch and then merge
git branch -d newBranch //deleting the branch
git remote -v // tp show remote url
git remote add [short name] [url] //add more repositories
Fork a Repository:
● This feature of GitHub allows us to make a mutable copy of a read only public repository into our own GitHub repository and work with it.
- ● This feature also allows us to stay in sync with the original repository by simple git pull/ git fetch commands.
-----
Adding Remote
git remote add nu https://github.com/xxxxx.git
All available Branches in all remotes
git branch -a
Fetch Code from particular Remote
git fetch nu
Going into Remote Branch
git checkout -t origin/development
Merging the nu remote code to ur development Branch
git merge krishna/development
IMPortent Commands:
To get the Other Branch code and Merge to your Branch
1.Commit your Code
2.Fetch other Branch Code
3.Merge to your Branch
git commit -am "Commit Message"
git fetch krishna //krishna is the Remote name of other Developer
git merge krishna/brnach3 // remote name/Branch Name
----
To Push Your Code to Server:
1.Commit Your Code
2.Push Code
git commit -am "Commit Message"
git push origin ARC
----