Top 50 Git Interview Questions with Answers

Git Interview Questions with Answers
  1. What is Git?
    a. A version control system
    b. A programming language
    c. A software suite
    d. An operating system

Answer: a

  1. Who developed Git?
    a. Linus Torvalds
    b. Richard Stallman
    c. Bill Gates
    d. Steve Jobs

Answer: a

  1. What is a repository?
    a. A location where code is stored
    b. A person who manages code
    c. A type of code
    d. A software program

Answer: a

  1. What is a branch?
    a. A separate version of the code
    b. A type of commit message
    c. A way to share code with others
    d. A type of tag

Answer: a

  1. What is a commit?
    a. A change made to the code
    b. A type of pull request
    c. A way to merge code
    d. A feature request

Answer: a

  1. What is a pull request?
    a. A way to propose changes to the code
    b. A way to revert changes
    c. A way to merge changes
    d. A way to delete code

Answer: a

  1. What is a merge conflict?
    a. A problem that occurs when two or more people make changes to the same code
    b. A type of error
    c. A type of commit message
    d. A way to share code with others

Answer: a

  1. What is a tag?
    a. A way to mark a specific point in the code’s history
    b. A type of commit message
    c. A way to merge code
    d. A way to delete code

Answer: a

  1. What is a stash?
    a. A way to save changes without committing them
    b. A way to delete code
    c. A way to revert changes
    d. A way to share code with others

Answer: a

  1. What is a remote?
    a. A separate repository that is not on the local machine
    b. A person who manages code
    c. A type of code
    d. A software program

Answer: a

  1. What is the difference between git clone and git fork?
    a. Git clone makes a copy of the repository on your local machine, while git fork creates a copy on GitHub/GitLab.
    b. Git clone creates a copy of the repository on GitHub, while git fork creates a copy on your local machine.
    c. Git clone and git fork both do the same thing.
    d. Git clone creates a new branch, while git fork creates a new repository.

Answer: a

  1. What is the command to initialize a new Git repository?
    a. git init
    b. git clone
    c. git pull
    d. git push

Answer: a

  1. What is the command to add a file to the staging area?
    a. git add filename
    b. git commit
    c. git push
    d. git pull

Answer: a

  1. What is the command to commit changes?
    a. git commit -m “commit message”
    b. git add filename
    c. git push
    d. git pull

Answer: a

  1. What is the command to push changes to a remote repository?
    a. git push
    b. git pull
    c. git add filename
    d. git commit -m “commit message”

Answer: a

  1. What is the command to create a new branch?
    a. git branch new_branch_name
    b. git checkout new_branch_name
    c. git merge new_branch_name
    d. git clone new_branch_name

Answer: a

  1. What is the command to switch to a different branch?
    a. git checkout branch_name
    b. git branch new_branch_name
    c. git merge branch_name
    d. git clone branch_name

Answer: a

  1. What is the command to merge one branch into another?
    a. git merge branch_name
    b. git clone branch_name
    c. git add filename
    d. git push

Answer: a

  1. What is the command to view the commit history?
    a. git log
    b. git branch
    c. git clone
    d. git commit

Answer: a

  1. What is the command to revert changes?
    a. git revert
    b. git reset
    c. git checkout
    d. git pull

Answer: a

  1. What is the command to undo the last commit?
    a. git reset HEAD~1
    b. git revert HEAD~1
    c. git checkout HEAD~1
    d. git commit –amend

Answer: a

  1. What is the difference between git pull and git fetch?
    a. Git pull fetches changes and merges them, while git fetch only fetches changes.
    b. Git pull only fetches changes, while git fetch fetches and merges changes.
    c. Git pull and git fetch do the same thing.
    d. Git pull and git fetch are not actual Git commands.

Answer: a

  1. What is the command to view the changes made to a file?
    a. git diff filename
    b. git log
    c. git branch
    d. git clone

Answer: a

  1. What is the command to create a tag?
    a. git tag tag_name
    b. git push
    c. git pull
    d. git add filename

Answer: a

  1. What is the command to delete a branch?
    a. git branch -d branch_name
    b. git clone branch_name
    c. git add filename
    d. git commit -m “commit message”

Answer: a

  1. What is the command to view the status of the repository?
    a. git status
    b. git log
    c. git branch
    d. git clone

Answer: a

  1. What is the command to view the remote repositories?
    a. git remote -v
    b. git clone
    c. git add filename
    d. git commit -m “commit message”

Answer: a

  1. What is the command to rename a file?
    a. git mv old_filename new_filename
    b. git add filename
    c. git commit -m “commit message”
    d. git push

Answer: a

  1. What is the command to undo changes made to the staging area?
    a. git reset filename
    b. git add filename
    c. git commit -m “commit message”
    d. git push

Answer: a

  1. What is the command to view the changes made to the repository?
    a. git diff
    b. git log
    c. git branch
    d. git clone

Answer: a

  1. What is the command to view the list of remote branches?
    a. git branch -r
    b. git log
    c. git status
    d. git clone

Answer: a

  1. What is the command to fetch changes from a remote repository?
    a. git fetch
    b. git pull
    c. git push
    d. git clone

Answer: a

  1. What is the command to view the list of tags?
    a. git tag
    b. git branch
    c. git log
    d. git clone

Answer: a

  1. What is the command to view the difference between two branches?
    a. git diff branch_1..branch_2
    b. git merge branch_1 branch_2
    c. git pull branch_1 branch_2
    d. git push branch_1 branch_2

Answer: a

  1. What is the command to move a commit from one branch to another?
    a. git cherry-pick commit_hash
    b. git merge branch_1 branch_2
    c. git checkout branch_name
    d. git push

Answer: a

  1. What is the command to rebase a branch?
    a. git rebase branch_name
    b. git merge branch_name
    c. git add filename
    d. git push

Answer: a

  1. What is the command to view the current branch?
    a. git branch
    b. git clone
    c. git log
    d. git status

Answer: a

  1. What is the command to view the list of commits for a specific file?
    a. git log filename
    b. git branch
    c. git checkout
    d. git push

Answer: a

  1. What is the command to undo changes to a specific file?
    a. git checkout filename
    b. git reset filename
    c. git add filename
    d. git push

Answer: a

  1. What is the command to delete a tag?
    a. git tag -d tag_name
    b. git push
    c. git pull
    d. git add filename

Answer: a

  1. What is the command to change the commit message?
    a. git commit –amend
    b. git reset
    c. git revert
    d. git push

Answer: a

  1. What is the command to delete untracked files?
    a. git clean -f
    b. git reset
    c. git revert
    d. git add filename

Answer: a

  1. What is the command to set up a Git repository with a remote?
    a. git remote add remote_name remote_url
    b. git push
    c. git pull
    d. git add filename

Answer: a

  1. What is the command to add multiple files to the staging area?
    a. git add .
    b. git add *
    c. git add filename1 filename2
    d. git add -a

Answer: a

  1. What is the command to view the list of contributors to the repository?
    a. git shortlog
    b. git branch
    c. git log
    d. git clone

Answer: a

  1. What is the command to view the version number of Git?
    a. git –version
    b. git version
    c. git branch
    d. git clone

Answer: a

  1. What is the command to discard changes made to a file?
    a. git checkout filename
    b. git reset filename
    c. git add filename
    d. git push

Answer: a

  1. What is the command to view the list of files in the working directory?
    a. ls
    b. git ls
    c. git list
    d. git dir

Answer: a

  1. What is the command to discard changes made to the entire repository?
    a. git reset –hard
    b. git revert
    c. git add .
    d. git push

Answer: a

  1. What is the command to stash changes without committing them?
    a. git stash
    b. git reset
    c. git revert
    d. git push

Answer: a

Top 50 DevOps Interview Questions with Answers

DevOps Interview Questions with Answers

1. What is DevOps?

a. A methodology that emphasizes communication and collaboration between software developers and IT operations
b. A software testing methodology
c. A programming language

Answer: A

2. What is Git?

a. A version control system
b. A programming language
c. A software development framework

Answer: A

3. What is continuous integration?

a. The process of continuously testing software throughout its development cycle
b. The process of continuously deploying software throughout its development cycle
c. The process of continuously writing code without interruption

Answer: A

4. What is Docker?

a. A containerization technology
b. A programming language
c. A software development framework

Answer: A

5. What is cloud computing?

a. The delivery of computing services over the internet
b. The delivery of computing services locally on a single machine
c. The delivery of computing services via USB drives

Answer: A

6. What is Configuration Management?

a. The process of managing and maintaining computing systems
b. The process of managing and maintaining software development teams
c. The process of managing and maintaining physical infrastructure

Answer: A

7. What is Infrastructure as Code (IaC)?

a. The practice of automating infrastructure management through code
b. The practice of manually configuring infrastructure
c. The practice of outsourcing infrastructure management

Answer: A

8. What is Puppet?

a. A configuration management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

9. What is Ansible?

a. A configuration management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

10. What is Jenkins?

a. A continuous integration and continuous delivery tool
b. A programming language
c. A software development framework

Answer: A

11. What is Nagios?

a. A monitoring tool
b. A programming language
c. A containerization technology

Answer: A

12. What is Chef?

a. A configuration management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

13. What is Kubernetes?

a. A container orchestration tool
b. A programming language
c. A software development framework

Answer: A

14. What is Amazon Web Services (AWS)?

a. A cloud computing platform
b. A programming language
c. An operating system

Answer: A

15. What is Terraform?

a. An infrastructure as code tool
b. A containerization technology
c. A continuous integration tool

Answer: A

16. What is SaltStack?

a. A configuration management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

17. What is Splunk?

a. A log management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

18. What is ELK?

a. A log management tool
b. A configuration management tool
c. A containerization technology

Answer: A

19. What is Graylog?

a. A log management tool
b. A containerization technology
c. A cloud computing platform

Answer: A

20. What is Prometheus?

a. A monitoring tool
b. A containerization technology
c. A cloud computing platform

Answer: A

21. What is Grafana?

a. A visualization tool
b. A containerization technology
c. A cloud computing platform

Answer: A

22. What is Selenium?

a. A testing tool
b. A containerization technology
c. A cloud computing platform

Answer: A

23. What is JIRA?

a. A project management tool
b. A programming language
c. A containerization technology

Answer: A

24. What is Maven?

a. A build automation tool
b. A containerization technology
c. A cloud computing platform

Answer: A

25. What is Gradle?

a. A build automation tool
b. A containerization technology
c. A cloud computing platform

Answer: A

26. What is HipChat?

a. A chat tool for teams
b. A programming language
c. A containerization technology

Answer: A

27. What is Travis CI?

a. A continuous integration and continuous delivery tool
b. A programming language
c. A containerization technology

Answer: A

28. What is CircleCI?

a. A continuous integration and continuous delivery tool
b. A programming language
c. A containerization technology

Answer: A

29. What is CodeDeploy?

a. A continuous deployment tool
b. A programming language
c. A containerization technology

Answer: AAnswer: A

30. What is CodePipeline?

a. A continuous delivery tool
b. A programming language
c. A containerization technology

Answer: AAnswer: A

31. What is SRE?

a. Site Reliability Engineering
b. Software Resource Engineering
c. System Reliability Engineering

Answer: A

32. What is Blue/Green deployment?

a. A deployment strategy that involves switching between two identical environments
b. A deployment strategy that involves a single environment
c. A deployment strategy that involves multiple environments

Answer: A

33. What is Canary deployment?

a. A deployment strategy that involves releasing a new version to a small subset of users before a full release
b. A deployment strategy that involves releasing a new version to all users simultaneously
c. A deployment strategy that involves delaying the release of a new version until all testing is complete

Answer: A

34. What is Agile?

a. A development methodology that emphasizes communication and flexibility
b. A software testing methodology
c. A programming language

Answer: A

35. What is Scrum?

a. An Agile framework for managing software development
b. A containerization technology
c. A cloud computing platform

Answer: A

36. What is Lean?

a. An Agile framework for managing software development
b. A containerization technology
c. A software development methodology

Answer: A

37. What is Kanban?

a. An Agile framework for managing software development
b. A containerization technology
c. A cloud computing platform

Answer: A

38. What is Pair Programming?

a. A software development practice that involves two programmers working together on the same computer
b. A containerization technology
c. A cloud computing platform

Answer: A

39. What is Continuous Delivery?

a. The practice of continuously deploying software throughout its development cycle
b. The practice of continuously testing software throughout its development cycle
c. The practice of continuously writing code without interruption

Answer: A

40. What is Continuous Deployment?

a. The automated deployment of software throughout its development cycle
b. The manual deployment of software throughout its development cycle
c. The practice of writing code without deploying it

Answer: A

41. What is Code Review?

a. The process of reviewing code for quality, correctness, and security
b. The process of writing code without review
c. The process of reviewing code only for security

Answer: A

42. What is a Pull Request?

a. A request to merge code changes into a codebase
b. A request to push code changes into a codebase
c. A request to delete code from a codebase

Answer: A

43. What is a Code Repository?

a. A central location for storing and managing code
b. A physical storage location for computing systems
c. A tool for monitoring software development teams

Answer: A

44. What is a Branch?

a. A copy of a codebase that can be modified independently
b. A copy of a codebase that cannot be modified
c. A copy of a codebase that can only be accessed by certain team members

Answer: A

45. What is Merge Conflict?

a. When two or more changes are made to the same line of code and a merge cannot be automatically completed
b. When two or more changes are made to different lines of code and a merge cannot be completed
c. When two or more people are trying to merge changes at the same time

Answer: A

46. What is DevOps Culture?

a. A culture that emphasizes communication, collaboration, and automation between software development and IT operations teams
b. A culture that emphasizes individual work and autonomy
c. A culture that emphasizes hierarchy and top-down management

Answer: A

47. What is Observability?

a. The measure of how well a system can be understood from the outside
b. The measure of how well a system can be understood from the inside
c. The measure of how well a system can be scaled

Answer: A

48. What is Microservices Architecture?

a. A software architecture that emphasizes small, independently deployable services
b. A software architecture that emphasizes large, monolithic services
c. A software architecture that emphasizes manual deployment of services

Answer: A

49. What is Serverless Computing?

a. A computing model where the cloud provider manages server infrastructure and only charges for usage
b. A computing model where the cloud provider manages server infrastructure and charges a flat fee
c. A computing model where the user manages server infrastructure

Answer: A

50. What is ChatOps?

a. The practice of conducting operations through a group chat interface
b. The practice of conducting operations through voice chat
c. The practice of conducting operations through email

Answer: A

How to Install and configure Git and GitHub on windows

Step 01 : Download Git

https://git-scm.com

Step 02 : GitHub

https://github.com

Step 03 : Create new Repositories

Step 04 : Open Git Bash

Create folder name:- First in ” C local disk”.

Step 05 : Configure

Step 06 : Create files inside FirstGit and commit, upload in account

Like :- test.txt file inside FirstGit

Open txt file and type some text like :- “This is my first work”.

Step 07 : Upload this file to GitHub

Step 08 : Commit and upload

# Note : Refresh Page.

Step 09 : Change in txt file and push

Change in txt file like :-

This is my first work
This is my first work
This is my first work
This is my first work
This is my first work

Save file.

Refresh Page.

Tagged : / / / / / /

Top 10 Website to Host Git Repository Online

In any industry, code has become one of the most business-critical assets. As a result, storing, securing, and collaborating around code has become a significant challenge for enterprises large and small.

Choosing the right source code management solution is no easy task. Even more so when you think about hosting your code behind your own firewall.

This post takes you through this decision – starting with a few common questions.

One of the first questions you’ll need to answer for yourself is: do you have the resources and expertise to professionally manage your code’s on-premises hosting?

1. Is On-Premise Hosting the Right Choice for You?

Any IT department must follow strict security policies. If your organization’s policies require you to keep your code in-house, then of course you will have to deal with hosting your code behind your firewall.

However, self-hosting your code is not a decision you should rush. There is much to keep in mind.

Security:

In an on-premises scenario, your IT department is responsible for setting up a secure environment and installing relevant updates consistently. Keeping a server secure and properly maintained is nothing to be taken lightly.

Availability / Backups:

Today, the code is important to many areas within the company. Therefore its permanent availability is often important. You should make sure that your server has little or no downtime.

Also, note that losing code can be a life-threatening event for many enterprises. You need to provide a completely fail-safe and complete backup strategy in order to make data loss impossible.

Integrations:

Also, think about other systems that need to interact with your code repository. Things like continuous integration servers or issue tracking systems can be other important parts of your software cycle.

Make sure they can be integrated with your code hosting platform – whether it’s behind a firewall or in the cloud.

Budget:

Depending on your needs, the size of your team, and the number of repositories, different solutions come at wildly different prices. This is true for both self-hosted installations and online services. You need to make sure that your own IT department can handle core subjects like security and maintenance flawlessly.

2. Commercial or OpenSource?

As of today, almost all source code hosting options are commercial systems. In fact, the main argument for paying a really high price sometimes is the professional support that it includes. For further updates in case of problems/queries, you can count on the professionals who help you.

If you don’t need these services, you can consider an open-source solution.

3. Complementing Tools

As with most solutions, the actual task of “source code management” is only part of their offering. This makes sense if you consider that today, software development involves a myriad of different tools and workflows – the ones that work best when tightly integrated with one another. Think issue tracking, code reviews, continuous integration systems, etc.

Here is the list of Top 10 Website to Host Git Repository Online:

1. Amazon AWS CodeCommit:

Amazon’s AWS platform includes hosting for Git repositories. It also comes with features that facilitate collaboration, such as code review and access control.

AWS CodeCommit is a secure, highly scalable, managed source control service that hosts private Git repositories. It makes it easy for teams to collaborate on code securely, including encrypted contributions in transit and at rest. CodeCommit eliminates the need for you to manage your own source control system or worry about scaling up its infrastructure. You can use CodeCommit to store anything from code to binaries. It supports the standard functionality of Git, so it works seamlessly with your existing Git-based tools.

Benefits:

  • Fully managed
  • Secure
  • High availability
  • Faster development lifecycle
  • Use your existing tools
  • Collaborate on code

2. Assembla:

Assembla has a long history in the business with its Subversion hosting. It includes a “workspace” platform with issue management, time tracking, and collaboration tools such as Wiki and its own messaging system.

It is a source code management tool that specializes in providing cloud-based version control services for code projects and agile software development. They provide an additional project management tool for those who use their cloud repositories.

Features:

  • Work together with Git merge requests
  • Collaboration
  • Integrated Issue Tracking
  • Security
  • Package Management
  • Project Management
  • Code Analysis

3. Beanstalk:

Being a very lean and reliable service, Beanstalk is a great option for businesses. It provides its own “deployment” infrastructure and integrates well with other tools such as Zendesk, FogBugz, Basecamp, or Lighthouse.

Features:

  • Easy-to-use service for deploying.
  • Scaling web applications
  • Services developed with Java
  • Backup / Recovery
  • Development Environment
  • Testing

4. Bitbucket:

Bitbucket, one of the giants in the industry.

The biggest advantage of Bitbucket Server is certainly that it comes from Atlassian – the company that develops highly popular products like JIRA and Confluence. This is why the integration with these tools (especially JIRA) in BitBucket Server is seamless.

BitBucket Server is an obvious choice if your development toolchain already relies on other Atlassian products like JIRA and Bamboo.

Features:

  • Merge Checks.
  • Code search
  • Git Large File Storage
  • Bitbucket Pipelines
  • IP whitelisting.

5. Codebase:

One of the few platforms to support Git, Subversion, and Mercurial. Additionally, ticketing, project management, and deployment infrastructure tools are included. The codebase is packed with features to help you manage your code and your project with ease.

Features:

  • Repository Hosting
  • Exception Tracking
  • Time Tracking
  • Customizable Permissions
  • Complete Developer API
  • Powerful Searching & Filtering
  • Custom Branding

6. RhodeCode:

Sophisticated code review and approval system including news feed and mention system. With features like LDAP support and IP restrictions, Roadcode seems to be geared for corporate use.

Roadcode allows developers to use not only Git but Mercurial and Subversion for revision control. Feature-wise, the platform offers the most important collaboration features such as code reviews and pull requests – but banks on flexible integration with external tools for both issue tracking and continuous integration.

Features:

  • Advanced code reviews.
  • Side-by-side diffs.
  • Pull requests.
  • Inline source code chat.
  • Full-text code search and source code indexing.
  • Web-based file adding, editing, deletion.

7. SourceForge:

SourceForge is an open-source community resource that is dedicated to helping you succeed as much as possible in open-source projects. We thrive on community collaboration to help make it a premier resource for open-source software development and distribution.

A classic hosting site whose reputation took a turn for the worse in the early 2010s after some shady practices, SourceForge has been under new ownership since 2016 and is determined to restore its good reputation.

Features:

  • Unlimited bandwidth for Open Source projects
  • Integrated Issue Tracking
  • Spambot protection
  • Extensive worldwide mirror network
  • Download statistics over time, by platform, and by region.
  • Analytics is completely free, takes no time to set up.
  • Automatic platform detection

8. Perforce Helix:

Perforce has the longest history in source code management of all the companies in this overview. It is mostly known for having an impressive tradition in enterprise code hosting through its own Perforce version control system. Recently, however, the company expanded its offering with its new Helix4Git platform.

Features:

  • Security and scalability
  • By mirroring work into a Perforce server
  • Specific branches and files can be locked

Especially will large companies appreciate the long-term experience Perforce as source code management provider; Enterprises can ensure that is well understood their needs and requirements.

9. GitHub:

GitHub is an increasingly popular programming resource that is used to share the access code. It is a social networking site for programmers that use a large range of companies and organizations’ project management and collaboration.

Undisputed number one in the open-source world is having projects like Ruby on Rails or jQuery hosted on GitHub. Offerings include great code review and collaboration features.

Features:

  • Drag and Drop Gist Code.
  • Creating a folder via the Web Interface
  • Using Git URL Shortener.
  • Task Checklist.
  • Using Github Command Line Interface.

10. GitLab:

GitLab is a web-based Git repository that offers free open and private repositories, issue-following capabilities, and wikis. This is a full DevOps platform that enables all tasks to professionals from the project planning and source code management, monitoring, and security. It allows teams to collaborate and build better software.

With open-source background, GitLab code provides the perfect platform to develop at a rapid pace for cooperation. The free Community Edition and Enterprise Edition can be installed on your own servers. A hosted offering running on GitLab.com is also available.

Features:

  • Offers git repository management.
  • Code Reviews
  • Issue tracking
  • Activity feeds and wikis

GitLab teams product helps increase reducing lifecycle and productivity, which creates value for customers return.

There’s a good chance that one of these solutions is the perfect choice for your requirements.

Tagged : / / / / / / / / / / / /

Git Commands Tutorials and Example: Git Reset – Git Revert

A committed snapshot can be undone with the git reverse command. Rather than removing the commit from the project history, it determines how to reverse the modifications made by the commit and adds a new commit with the resulting content. This prevents Git from losing history, which is critical for maintaining the integrity of your revision history and collaborating with confidence.

Reverting vs. Resetting:-

git revert

Use of Git Reset, Git Revert, Git Checkout & Squash Commit | by Ameet  Prajapati | MindOrks | Medium

It’s crucial to note that git revert just undoes a single commit; it doesn’t “revert” a project to its prior state by deleting all future commits. This is referred to as a reset rather than a revert in Git.

Compared to resetting, reverting offers two significant advantages. It is a “safe” action for commits that have already been published to a shared repository since it does not affect the project history. Please check the git reset page for further information on why changing shared history is harmful.

Second, although git reset can only go backwards from the current commit, git revert can target a specific commit at any time in the history. If you wanted to undo an old commit with git reset, for example, you’d have to erase all commits that came after the target commit, then remove the target commit and re-commit all subsequent commits. Needless to say, this isn’t a really elegant undo method.

git reset

git reset soft: When to Use Git Reset, Git Revert & Git Checkout - DEV  Community

If git revert is the “safe” approach to reverse changes, git reset may be considered the “dangerous” alternative. There is no way to recover the original copy when you undo with git reset (and the commits are no longer referenced by any ref or the reflog). When using this tool, be cautious because it’s one of the few Git commands that might cause you to lose your work.

What are Uses of:-

git reset:-

  • The selected file will be removed from the staging area, but the working directory will remain unaltered. This removes a file off the stage without overwriting any modifications.
  • The staging area should be reset to reflect the most recent commit, but the working directory should remain untouched. This upstages all files without overwriting any modifications, allowing you to re-create the staged snapshot from the ground up.
  • Back up the current branch tip to and reset the staging area to match, but don’t touch the working directory. Since then, all changes have been saved in the working directory, allowing you to re-commit the project history with cleaner, more atomic snapshots.

git reset –hard:-

  • To match the most current commit, reset the staging area and working directory. The –hard flag tells Git to overwrite all changes in the working directory, in addition to upstaging modifications. To put it another way, this deletes any uncommitted modifications, so make sure you truly want to get rid of your local changes before using it.
  • Reset both the staging area and the working directory to reflect the current branch tip’s position. This removes not just the uncommitted modifications, but also all subsequent commits.

Tagged : / / / / / / / /

Top 5 Git Version Control Software in Cloud

Version control is a way to keep track of changes to code so that if something goes wrong, we can compare across different code versions and go back to any previous versions we want. This is very essential where many developers are constantly working on/changing the source code.

Benefits of Version Control Software:

The main advantages of using version control software include streamlining the development process, managing the code for multiple projects, and keeping a history of all changes within a code.

A version control software saves all the changes in a repository. So, if developers make a mistake, they can undo it. Also, they can compare the new code with the previous version to resolve their grievance. It can reduce human errors and unintended consequences to a great extent. Very suitable for any web development company around the world.

In addition, it facilitates the management of the project’s centralized repository, file storage, documents, and other information related to the project.

Here is the list of Top 4 git version control software in cloud:

1. GitHUb

GitHub helps software teams collaborate and maintain a full history of code changes. You can track changes in the code, turn back the clock to undo errors, and share your efforts with other team members.

It is a repository for host Git projects. For those wondering what is Git? It is an open-source version control system with local branching, multiple workflows, and convenient staging areas. Git version control is an easy-to-learn alternative and provides faster operation speeds.

Features:

  • Drag and Drop Gist Code.
  • Creating a folder via the Web Interface.
  • Using Github Command Line Interface.
  • Linking Lines.

2. GitLab

GitLab comes with a number of useful features such as an integrated project, a project website, etc. By using GitLab’s continuous integration (CI) capabilities, you can test and distribute code automatically.

You can access all aspects of a project, view the code, receive requests and add conflict resolution.

This version control software is designed for the DevOps lifecycle. Meaning, your projects are quite complex and involve cloud engineering and the like. Gitlab provides basic features such as view code, pull requests, and merge resolution.

  • Development.
  • Security.
  • Ops teams collaborate
  • Build software
  • Reduce development costs

4. Beanstalk

Beanstalk is a perfect choice for those who need to work from remote locations. This software is based on browser and cloud, which allows users to code, commit, review and deploy using the browser.

It allows users to code, commit, review, and deploy code using the browser. For its ease of use, you can integrate it with any messaging or email platform for efficient collaboration.

It can be integrated with messaging and email platforms for efficient collaboration regarding code and updates. It supports both Git and SVN and also comes with built-in analytics features. For security, it takes advantage of encryption, two-factor authentication, and password protection functions.

Features:

  • Variety of Application Deployment Options.
  • Wide Selection of Application Platforms.
  • Management and Updates.
  • Customization
  • Scaling
  • Compliance

4. HelixCore

Helix is one of the best version control systems. It provides an integrated platform for collaborative development and protection of intellectual property of any kind. It benefits from several new capabilities, support for both distributed and centralized development workflows. Helix also provides a complete Git ecosystem. And it comes in both on-premises and cloud versions.

Helixcore provides seamless team collaboration and support for both centralized and distributed development workflows. It is available for both cloud and on-premises deployments, which makes it scalable.

Features:

  • Work order management
  • Applications Management
  • Document Management
  • Access Controls
  • Procurement Management

5. Apache Subversion

Apache Subversion is another open-source version control system, founded a few decades ago by CollabNet. Both open-source arenas and enterprises consider it a reliable option for valuable data.

SVN is easy to implement with any programming language. Also, it provides persistent storage for handling text and binary files.

Features:

  • Inventory management
  • Security management
  • History tracking
  • User access controls
  • Data recovery
  • Workflow management

These are the best version control systems that a web development company should definitely consider using, according to the requirements.

Tagged : / / / / / /

List of Top 5 Git repository management systems in 2021

  1. GitHub.
  2. Bitbucket.
  3. Assembla.
  4. RhodeCode.
  5. DevZing Subversion.

GitHub:-

Github is a collaborative coding tool with version control, branching, and merging all included.

GitHub is the best place to share code with friends, co-workers, classmates, and strangers.

Bitbucket:-

Bitbucket is a cloud-based Git and Mercurial-based source code management and collaboration tool.

Bitbucket is a cloud-based hosting service for projects that use either the Mercurial or Git revision control systems.

Assembla:-

Enterprise cloud version control for secure source code management in the cloud.

Assembla is the world’s only Enterprise Cloud Version Control (ECVC) provider, bringing multi-repository secure source code management to the cloud.

RhodeCode:-

RhodeCode is a fast and powerful management tool for Mercurial and GITand SVN with a built-in push/pull server, full-text search, pull requests, and code-review system.

RhodeCode is a fast and powerful management tool for Mercurial and GIT and Subversion with a built-in push/pull server, full-text search, pull requests, and powerful code-review system. It works on http/https and has a range of unique features.

DevZing Subversion:-

High-speed, secure, available subversion hosting.

Your code is safe and secure and accessible from anywhere.

All plans support SSL (https) for connecting to your repositories.

Free import from other Subversion systems. Friction-free migration.

Send an email on every commit. Always know who is updating your repositories.

What is git?

Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

Why do we need git?

Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all to be merged into one source.

What is the role of Git repository managment systems?

  • Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
  • It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows.
  • A Git repository is the . git/ folder inside a project.
  • This repository tracks all changes made to files in your project, building a history over time.
Tagged : / / / / /

Enforce the JIRA issue id in a GIT commit message

Enforce the JIRA issue id in a GIT commit message

This can be done by using git hooks file location at .git/hooks/commit-msg. Following are the 2 way in whcih each Developers can set the Hooks in their developement envioronment.

Method – 1

# commit-msg.sh
#!/bin/sh
# This hook will make sure that the commit message contains a JIRA issue.
#
# To enable this hook, rename this file to ".git/hooks/commit-msg".
# Make sure to add execution permissions to the file.

export MESSAGE=$(<$1)
export JIRA_ISSUE_TAG='ISSUETAG-([0-9]*)'

if [[ $MESSAGE =~ $JIRA_ISSUE_TAG ]]; then
echo -e "\e[32mGreat, your commit message contains a JIRA issue!\e[0m"
exit 0;
fi

echo -e "\e[31mOh hamburgers ... You forgot to add a JIRA issue number!\e[0m";
exit 1;

Method 2 – This is another very good example to implement to force jira id in each commit message. http://nsbogan.com/tools/2015/06/04/jira-id-in-git-commit-messages

Tagged : / / / /

Best Branching and Merging strategies in git

Best Branching and Merging strategies in git

Step 1 – First you need to learn the needs of branches. This is very good read.

  • https://docs.microsoft.com/en-us/vsts/repos/tfvc/branching-strategies-with-tfvc?view=vsts

Step 2 – Now time has come to Learn best branching model in Git.

  • https://buddy.works/blog/5-types-of-git-workflows
  • https://hackernoon.com/a-branching-and-releasing-strategy-that-fits-github-flow-be1b6c48eca2
  • https://nvie.com/posts/a-successful-git-branching-model/

Step 3 – Now, Lets understand, what is the kind of merges we have in Git?

  • https://www.atlassian.com/git/tutorials/using-branches/git-merge
  • https://git-scm.com/docs/merge-strategies
  • https://stackoverflow.com/questions/366860/when-would-you-use-the-different-git-merge-strategies

Step 4 – Are you still having a questions, Please post in the comment section.

Tagged : / / / / / / /

How to update or pull current branch before committing in Git?

Best practice says that before you commit in git, you need to either do git pull or git fetch/merge. However, there is a way to find out wheather your branches is not in sync with remote.

To check the remote repo status you are really simulating a “fetch”
$ git fetch -v –dry-run

To bring your remote refs up to date
$ git remote -v update

This command will print whether the branch you are tracking is ahead, behind or has diverged with remote. If it says nothing, the local and remote are the same.
$ git status -uno

To pull
$ git pull origin <<branchname>>
or
$ git fetch origin <<branchname>>
$ git merge remote/<<branchname>>
$ git commit

Compare the two branches:
$ git log HEAD..origin/master –oneline

Tagged : / / / / / /