...
The most common case is if the master branch is updated after you've already split a new branch off of it. You won't be able to merge in your branch if it's missing commits that are in master, so you'll need to merge master into your branch. To do this, you'll need to be in your branch. Run "git pull" to grab all the latest changes, then run
git merge <branch-name>
or git merge master
in this case to make the merge. If you're lucky, this will be all you need to do, but sometimes you'll run into dreaded merge conflicts.
...
These are the ones that are probably most useful to developers starting out. A more in-depth cheatsheet can be found here or here or here.
Command | Description |
---|---|
git clone <link> | Creates a copy of a repository from a specified link and downloads it to the local machine. |
git pull | Fetches changes from a remote repository and merges them into the current branch. |
git add |
<path(s)-to- |
file-or- |
folder> | Stages |
specific files or folders in the working directory for the next commit. | |
git add -A | Stages all changes, including untracked files and deletions, in the working directory for the next commit. |
git add . | Stages all changes in the current directory for the next commit. |
git commit | Records changes in the staged area, creating a new commit. Opens the default text editor for the user to specify a commit message. |
| Records changes in the staged area, creating a new commit with a commit message specified in the command itself. |
| Pushes local commits to a remote repository, updating the remote branch with the latest changes. |
| Displays the status of changes as untracked, modified, or staged in the working directory. |
| Lists all local branches and highlights the currently active branch. |
| Lists all branches including remote branches. |
| Switches between branches or restores working tree files. |
| Creates a new branch and switches to it in a single command. |
| Merges changes from a specified branch into the current branch. |
| Shows the differences between the working directory and the staging area. |
| Displays the differences between the staging area and the last commit. |
| Fetches changes from a remote repository without merging them into the local branches. |
| Displays the commit history, showing details like commit messages, authors, and timestamps. |
| Displays a simplified one-line commit history, showing abbreviated commit hashes and commit messages. |
| Temporarily saves changes that are not ready to be committed, allowing you to switch branches or perform other tasks. |
| Shows a list of stashed changes, including stash IDs and descriptions. |
| Applies the latest stash and removes it from the stash list. |
Resources
This article only provides the minimum information required to get started on Controls with Git; Git can do quite a bit more, and becoming familiar with its capabilities will place power in your hands. Some additional resources to further your knowledge include
...