GIT-Version Control Guide
Github :Central library (Repository) to host your code .
GIT >Write commands >Github
1.Tell Git who you are
configure author name and email to be used with our commits .
>git config --global user.name "xyz"
>git config --global user.email "xyz@gmail.com"
create some folder and put some file inside it generally your project folder .
first go to that folder using cd command
>git init
this will create one .git extension file(hidden file) in that folder
you have a code > Initialize It as Git Repositories (git init )
Staging >commit >publish to Github.
For Staging :
>git add * :to add all file to staging
>git add <filename> :to add specific file to staging
>git status : to check which all file are added to staging
For Commit :
Commit will always take file from staging so we will always do commit after staging .
>git commit -m "my first commit "
connect to a remote repository
we need to connect our local repo with remote github repository
>git remote add origin <remote server(repo link)>
Push our code from our local to remote Repository
by default we will be in master branch in remote repo
>git push origin master
ask for credentials
command to clone github repo for first time after that we can use git pull to pull down the changes
>git clone <github_repo_link>
>git pull origin master
#Branching in GIT
>git checkout -b <branch name> :to create new branch
>git checkout <branch name> :to switch branch
>git branch :to check current and all branch
To merge change from current branch to master branch
>git merge <current branch name>
All git commands : https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
Comments
Post a Comment