Ads

Git Notes and Interview Questions

 Version control software.

Manages code(version of codes)handling

Terminologies:

  • readme file

  • Repositories

  • Commit

  • Branch

  • merge

  • fork

  • Pull request

Branch:

Isolate development work without affecting other branches in the repository.

Why branching:

  • development purpose

  • Fix bugs

  • safely experiment new techiniques or ideas

Fork:

when community wants to contribute to the project.they cant directly merge ,they simply fork the project and can give thier suggestions or improvements inform of code,and it will be merged if it is accepted by the author.

then he will review,merge the code with comment

MErge conflict:

when two or more users worked on same line of code trying to merge thier code to master branch.then that merge conflict has to be resolved before merged to master.

Commands:

  • git config --global user.name ayyappan

  • git config --global user.email ayyappan.g@thinkpalm.com

  • git init--------->initialises the empty .git folder

  • git clone--->cloing the remote into local

  • git add sangar.html ---------->adding sample file to staging area

  • git status--->shows everything

  • git commit -m “message”---commit

  • git push origin master---push to remote

  • git push origin sangar

  • git rm --cached filename.js----------->remove

  • git log---->commit history

  • git branch “Sangar”==========created new branch

  • git checkout Sangar---->switching to another branch

  • git checkout main-->git merge Sangar--->merging sangar to main

  • once merge conflict occurs-->resolve it-->git add thatfile.html--->git commit -m “conflict resolved”

  • git pull origin sangar--->pulls from sangar

  • git reset head <file>--------->unstage changes(kind of reset)

  • git cherry-pick <commit>--->applies specific commit from one to another branch

  • git stash--->preserves our local changes

  • git stash list--->shows the list of stashes

  • git stash apply stash{0} ---->applied

  • git stash pop--->removes

  • git remote add origing <url>

Comments

Popular posts from this blog

Rest Assured Api Automation

Appium Notes

Jenkins Notes