Learn how to configure Git with your name and email, and how to check your current Git setup. Expand your programming skills further with our web development, Python, data science, and web design classes and bootcamps in NYC.
Key Insights
- To access the command line on Mac, navigate to Applications > Utilities and open Terminal.app. On Windows, use either the Command Prompt or Git Bash.
- To change the name linked to your Git, enter the command: git config --global user.name "Your Name", replacing "Your Name" with your actual first and last name.
- To set your email on Git, use the command: git config --global user.email "you@example.com", replacing "you@example.com" with your actual email.
- Changing the name and email on Git will only affect future work.
- You can check the name or email currently set in Git by running the same commands without quoting a value.
- Aside from Git, you can also learn various programming skills through web development, Python, data science, and web design classes and bootcamps available in NYC.
Resolve a Merge Conflict
-
Identify Conflicts
git status shows files with conflicts after a failed merge.
-
Open the Files
Look for <<<<<< / ====== / >>>>>> markers — your changes vs theirs.
-
Edit & Stage
Pick the right code, remove markers, git add the file.
-
Complete the Merge
git commit finalizes the merge with the resolved content.
Tell Git Your Name & Email
1. To access the command line, do the following instructions for your platform:
- Mac: Go to Applications > Utilities and open Terminal.app.
- Windows: If you're already familiar with the Windows Command Prompt and prefer it, launch that app. Otherwise, launch Git Bash, which may be an icon on your Desktop, or in the Windows Start menu (possibly in a Git folder).
2. Enter the following command, replacing Your Name with your actual first and last name (but keep the quotes around it):
Git config—global user.name "Your Name"
3. Enter the following command, replacing you@example.com with your actual email (but keep the quotes around it):
Git config—global user.email "you@example.com"
Keep in mind that changing the name and email will only affect future work.
Checking Your Git Setup (Name & Email)
To check the name or email currently set in Git, you can run the same commands, but without the value in quotes. So you'd use these commands:
Git config—global user.name
Git config—global user.email
Go Beyond Git
Git is an essential tool for collaborating with other programmers. Learn Git and more through our coding classes & bootcamps: