git拉取代码出现问题-新手解决

问题:自己创建新分支后,用新分支拉取代码报错:Your configuration specifies to merge with the ref 'refs/heads/xxxx' from the remote, but no such ref was fetched.

解决方法:(自己本地当前代码版本低于远程代码,需先用主分支拉取代码到本地,在合并代码到主分支)

1.首先查看所有分支 

 绿色表示自己当前本地分支,红色代表远程分支

2.切换到主分支(我这里主分支是main)

git checkout main

3.拉取代码

git pull

4.切换到自己新建分支

git checkout rensihang

5.将代码合并到自己的新分支上(注意:这里是填写主分支)

git merge main

此时自己本地代码和远程一样

6.需要的话,将自己代码提交远程

git push origin rensihang

注:内容为参考学习,如有问题,欢迎大家指出!

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
Leverage the power of Git to smooth out the development cycle Professional Git takes a professional approach to learning this massively popular software development tool, and provides an up-to-date guide for new users. More than just a development manual, this book helps you get into the Git mindset—extensive discussion of corollaries to traditional systems as well as considerations unique to Git help you draw upon existing skills while looking out—and planning for—the differences. Connected labs and exercises are interspersed at key points to reinforce important concepts and deepen your understanding, and a focus on the practical goes beyond technical tutorials to help you integrate the Git model into your real-world workflow. Git greatly simplifies the software development cycle, enabling users to create, use, and switch between versions as easily as you switch between files. This book shows you how to harness that power and flexibility to streamline your development cycle. Understand the basic Git model and overall workflow Learn the Git versions of common source management concepts and commands Track changes, work with branches, and take advantage of Git's full functionality Avoid trip-ups and missteps common to new users Git works with the most popular software development tools and is used by almost all of the major technology companies. More than 40 percent of software developers use it as their primary source control tool, and that number continues to grow; the ability to work effectively with Git is rapidly approaching must-have status, and Professional Git is the comprehensive guide you need to get up to speed quickly. Table of Contents PART I: UNDERSTANDING GIT CONCEPTS Chapter 1: What Is Git? Chapter 2: Key Concepts Chapter 3: The Git Promotion Model Connected Lab 1: Installing Git PART II: USING GIT Chapter 4: Configuration and Setup Chapter 5: Getting Productive Connected Lab 2: Creating and Exploring a Git Repository and Managing Content Chapter 6: Tracking Changes Connected Lab 3: Tracking Content through the File Status Life Cycle Chapter 7: Working with Changes over Time and Using Tags Connected Lab 4: Using Git History, Aliases, and Tags Chapter 8: Working with Local Branches Connected Lab 5: Working with Branches Chapter 9: Merging Content Connected Lab 6: Practicing with Merging Chapter 10: Supporting Files in Git Chapter 11: Doing More with Git Connected Lab 7: Deleting, Renaming, and Stashing Chapter 12: Understanding Remotes—Branches and Operations Connected Lab 8: Setting Up a GitHub Account and Cloning a Repository Chapter 13: Understanding Remotes—Workflows for Changes Connected Lab 9: Using the Overall Workflow with a Remote Repository Chapter 14: Working with Trees and Modules in Git Connected Lab 10: Working with Worktrees Connected Lab 11: Working with Submodules Connected Lab 12: Working with Subtrees Chapter 15: Extending Git Functionality with Git Hooks

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值