type of source code management?
local repo
remote repo
architecture of scm?
distributed architecture ( all users will have a local repo in their local pc and one as centrala repo othe n cloud (github,GitLab, bitbucket )
how to install git in Linux ?
redhat/cent os /aws linx
yum install git -y
ubuntu :
apt-get install git -y
how to configure the git profile?
git config --global user.name "coss"
git config --global user.email "[email protected]"
how to create a git repository for a regular folder ?
git init <--
it will create .git folder to track create/modify activity in the folder
stages of git repo ?
3 stages
working area
stage area
local repository DB
Git Status Terminology :
untrack files : ( working area)
to be committed ( staging area )
how to check stages?
git status
how to add files from wthe orking area to staging area?
git add . or git add file1
how to commit (save) to git repo db ?
git commit -m "first"
how to check git repo commits and who did,when ?
git log <--
how to check commits files in the repo ?
git show commit-id<--
create repository in git hub
login to GitHub , create a repository , give name " go-pro1" select public , create
how to add the github repository urlURL into local git ?
(on local git)
git remote add variable-name https://github.com/4linux/DevOpsLab-HelloWorld.git
how to push the latest version local db git commits to the GitHub repo "go-pro1"
git push -u origin master <--
how to see the remote repository URL url added to git?
git remote -v <--
how to delete the remote repository URL from git?
git remote rm origin
why tag?
friendly name for commit id
how assign a tag to commit -d ?
git tag -a login -m "login page" commit-id
syntax : git -d tagname , Example : git -d login <--
what revert in git ?
to undo from commit
git revert commit-id <--
is it possible to restore or undo the stage?
yes,
git restore --staged file
is it possible to undo a commit
git revert last-commit-id
give message for commit "sorry" :wq
what is fork in github ?
its a like clone from other github to my hub acccount but not git
what pull ?
pull latest contents from remote do update into wd and commit
git pull url
what is clone ?
git clone remote url
it will copy exact all remote repository to local new repo with the same name
what is branch ?
seperate workspace to perform seperate task for each feature or practice
ex:
master:(project)
home page -- commit
login --- commit
patch -- commit
how to create branch?
git branch bname
git branch<== to check list
git checkout bname <-- switch to another branch
note: when u create branch from master , it will create with all contents/commit of master
how to delete a branch?
git branch -d bname <--
how to merge one branch to another branch?
master : git merge login
how to create regular common commands as scripts to execute all at a time?
vi push.sh
git add .
git commit -m "message"
git push -u origin master
:wq
./push.sh
Comments
Post a Comment